diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index e6a01b1162e01..8c536753ca924 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -331,6 +331,7 @@ com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-compute-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 9cb3ad482fa80..4075ce0abd30e 100644 --- a/pom.xml +++ b/pom.xml @@ -736,6 +736,7 @@ sdk/cognitiveservices sdk/commerce sdk/communication + sdk/compute sdk/confidentialledger sdk/confluent sdk/consumption diff --git a/sdk/compute/azure-resourcemanager-compute-generated/CHANGELOG.md b/sdk/compute/azure-resourcemanager-compute-generated/CHANGELOG.md new file mode 100644 index 0000000000000..96c232437c3dc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-01-19) + +- Azure Resource Manager Compute client library for Java. This package contains Microsoft Azure SDK for Compute Management SDK. Compute Client. Package tag package-2021-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/compute/azure-resourcemanager-compute-generated/README.md b/sdk/compute/azure-resourcemanager-compute-generated/README.md new file mode 100644 index 0000000000000..d9b8cde81459c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Compute client library for Java + +Azure Resource Manager Compute client library for Java. + +This package contains Microsoft Azure SDK for Compute Management SDK. Compute Client. Package tag package-2021-11-01. 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-compute-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-compute-generated + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ComputeManager manager = ComputeManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` 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/compute/azure-resourcemanager-compute-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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 diff --git a/sdk/compute/azure-resourcemanager-compute-generated/SAMPLE.md b/sdk/compute/azure-resourcemanager-compute-generated/SAMPLE.md new file mode 100644 index 0000000000000..ce37e03031ad1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/SAMPLE.md @@ -0,0 +1,16660 @@ +# Code snippets and samples + + +## AvailabilitySets + +- [CreateOrUpdate](#availabilitysets_createorupdate) +- [Delete](#availabilitysets_delete) +- [GetByResourceGroup](#availabilitysets_getbyresourcegroup) +- [List](#availabilitysets_list) +- [ListAvailableSizes](#availabilitysets_listavailablesizes) +- [ListByResourceGroup](#availabilitysets_listbyresourcegroup) +- [Update](#availabilitysets_update) + +## CapacityReservationGroups + +- [CreateOrUpdate](#capacityreservationgroups_createorupdate) +- [Delete](#capacityreservationgroups_delete) +- [GetByResourceGroup](#capacityreservationgroups_getbyresourcegroup) +- [List](#capacityreservationgroups_list) +- [ListByResourceGroup](#capacityreservationgroups_listbyresourcegroup) +- [Update](#capacityreservationgroups_update) + +## CapacityReservations + +- [CreateOrUpdate](#capacityreservations_createorupdate) +- [Delete](#capacityreservations_delete) +- [Get](#capacityreservations_get) +- [ListByCapacityReservationGroup](#capacityreservations_listbycapacityreservationgroup) +- [Update](#capacityreservations_update) + +## CloudServiceOperatingSystems + +- [GetOSFamily](#cloudserviceoperatingsystems_getosfamily) +- [GetOSVersion](#cloudserviceoperatingsystems_getosversion) +- [ListOSFamilies](#cloudserviceoperatingsystems_listosfamilies) +- [ListOSVersions](#cloudserviceoperatingsystems_listosversions) + +## CloudServiceRoleInstances + +- [Delete](#cloudserviceroleinstances_delete) +- [Get](#cloudserviceroleinstances_get) +- [GetInstanceView](#cloudserviceroleinstances_getinstanceview) +- [List](#cloudserviceroleinstances_list) +- [Rebuild](#cloudserviceroleinstances_rebuild) +- [Reimage](#cloudserviceroleinstances_reimage) +- [Restart](#cloudserviceroleinstances_restart) + +## CloudServiceRoles + +- [Get](#cloudserviceroles_get) +- [List](#cloudserviceroles_list) + +## CloudServices + +- [CreateOrUpdate](#cloudservices_createorupdate) +- [Delete](#cloudservices_delete) +- [DeleteInstances](#cloudservices_deleteinstances) +- [GetByResourceGroup](#cloudservices_getbyresourcegroup) +- [GetInstanceView](#cloudservices_getinstanceview) +- [List](#cloudservices_list) +- [ListByResourceGroup](#cloudservices_listbyresourcegroup) +- [PowerOff](#cloudservices_poweroff) +- [Rebuild](#cloudservices_rebuild) +- [Reimage](#cloudservices_reimage) +- [Restart](#cloudservices_restart) +- [Start](#cloudservices_start) +- [Update](#cloudservices_update) + +## CloudServicesUpdateDomain + +- [GetUpdateDomain](#cloudservicesupdatedomain_getupdatedomain) +- [ListUpdateDomains](#cloudservicesupdatedomain_listupdatedomains) +- [WalkUpdateDomain](#cloudservicesupdatedomain_walkupdatedomain) + +## CommunityGalleries + +- [Get](#communitygalleries_get) + +## CommunityGalleryImageVersions + +- [Get](#communitygalleryimageversions_get) + +## CommunityGalleryImages + +- [Get](#communitygalleryimages_get) + +## DedicatedHostGroups + +- [CreateOrUpdate](#dedicatedhostgroups_createorupdate) +- [Delete](#dedicatedhostgroups_delete) +- [GetByResourceGroup](#dedicatedhostgroups_getbyresourcegroup) +- [List](#dedicatedhostgroups_list) +- [ListByResourceGroup](#dedicatedhostgroups_listbyresourcegroup) +- [Update](#dedicatedhostgroups_update) + +## DedicatedHosts + +- [CreateOrUpdate](#dedicatedhosts_createorupdate) +- [Delete](#dedicatedhosts_delete) +- [Get](#dedicatedhosts_get) +- [ListByHostGroup](#dedicatedhosts_listbyhostgroup) +- [Restart](#dedicatedhosts_restart) +- [Update](#dedicatedhosts_update) + +## DiskAccesses + +- [CreateOrUpdate](#diskaccesses_createorupdate) +- [Delete](#diskaccesses_delete) +- [DeleteAPrivateEndpointConnection](#diskaccesses_deleteaprivateendpointconnection) +- [GetAPrivateEndpointConnection](#diskaccesses_getaprivateendpointconnection) +- [GetByResourceGroup](#diskaccesses_getbyresourcegroup) +- [GetPrivateLinkResources](#diskaccesses_getprivatelinkresources) +- [List](#diskaccesses_list) +- [ListByResourceGroup](#diskaccesses_listbyresourcegroup) +- [ListPrivateEndpointConnections](#diskaccesses_listprivateendpointconnections) +- [Update](#diskaccesses_update) +- [UpdateAPrivateEndpointConnection](#diskaccesses_updateaprivateendpointconnection) + +## DiskEncryptionSets + +- [CreateOrUpdate](#diskencryptionsets_createorupdate) +- [Delete](#diskencryptionsets_delete) +- [GetByResourceGroup](#diskencryptionsets_getbyresourcegroup) +- [List](#diskencryptionsets_list) +- [ListAssociatedResources](#diskencryptionsets_listassociatedresources) +- [ListByResourceGroup](#diskencryptionsets_listbyresourcegroup) +- [Update](#diskencryptionsets_update) + +## DiskRestorePoint + +- [Get](#diskrestorepoint_get) +- [GrantAccess](#diskrestorepoint_grantaccess) +- [ListByRestorePoint](#diskrestorepoint_listbyrestorepoint) +- [RevokeAccess](#diskrestorepoint_revokeaccess) + +## Disks + +- [CreateOrUpdate](#disks_createorupdate) +- [Delete](#disks_delete) +- [GetByResourceGroup](#disks_getbyresourcegroup) +- [GrantAccess](#disks_grantaccess) +- [List](#disks_list) +- [ListByResourceGroup](#disks_listbyresourcegroup) +- [RevokeAccess](#disks_revokeaccess) +- [Update](#disks_update) + +## Galleries + +- [CreateOrUpdate](#galleries_createorupdate) +- [Delete](#galleries_delete) +- [GetByResourceGroup](#galleries_getbyresourcegroup) +- [List](#galleries_list) +- [ListByResourceGroup](#galleries_listbyresourcegroup) +- [Update](#galleries_update) + +## GalleryApplicationVersions + +- [CreateOrUpdate](#galleryapplicationversions_createorupdate) +- [Delete](#galleryapplicationversions_delete) +- [Get](#galleryapplicationversions_get) +- [ListByGalleryApplication](#galleryapplicationversions_listbygalleryapplication) +- [Update](#galleryapplicationversions_update) + +## GalleryApplications + +- [CreateOrUpdate](#galleryapplications_createorupdate) +- [Delete](#galleryapplications_delete) +- [Get](#galleryapplications_get) +- [ListByGallery](#galleryapplications_listbygallery) +- [Update](#galleryapplications_update) + +## GalleryImageVersions + +- [CreateOrUpdate](#galleryimageversions_createorupdate) +- [Delete](#galleryimageversions_delete) +- [Get](#galleryimageversions_get) +- [ListByGalleryImage](#galleryimageversions_listbygalleryimage) +- [Update](#galleryimageversions_update) + +## GalleryImages + +- [CreateOrUpdate](#galleryimages_createorupdate) +- [Delete](#galleryimages_delete) +- [Get](#galleryimages_get) +- [ListByGallery](#galleryimages_listbygallery) +- [Update](#galleryimages_update) + +## GallerySharingProfile + +- [Update](#gallerysharingprofile_update) + +## Images + +- [CreateOrUpdate](#images_createorupdate) +- [Delete](#images_delete) +- [GetByResourceGroup](#images_getbyresourcegroup) +- [List](#images_list) +- [ListByResourceGroup](#images_listbyresourcegroup) +- [Update](#images_update) + +## LogAnalytics + +- [ExportRequestRateByInterval](#loganalytics_exportrequestratebyinterval) +- [ExportThrottledRequests](#loganalytics_exportthrottledrequests) + +## Operations + +- [List](#operations_list) + +## ProximityPlacementGroups + +- [CreateOrUpdate](#proximityplacementgroups_createorupdate) +- [Delete](#proximityplacementgroups_delete) +- [GetByResourceGroup](#proximityplacementgroups_getbyresourcegroup) +- [List](#proximityplacementgroups_list) +- [ListByResourceGroup](#proximityplacementgroups_listbyresourcegroup) +- [Update](#proximityplacementgroups_update) + +## ResourceSkus + +- [List](#resourceskus_list) + +## RestorePointCollections + +- [CreateOrUpdate](#restorepointcollections_createorupdate) +- [Delete](#restorepointcollections_delete) +- [GetByResourceGroup](#restorepointcollections_getbyresourcegroup) +- [List](#restorepointcollections_list) +- [ListByResourceGroup](#restorepointcollections_listbyresourcegroup) +- [Update](#restorepointcollections_update) + +## RestorePoints + +- [Create](#restorepoints_create) +- [Delete](#restorepoints_delete) +- [Get](#restorepoints_get) + +## SharedGalleries + +- [Get](#sharedgalleries_get) +- [List](#sharedgalleries_list) + +## SharedGalleryImageVersions + +- [Get](#sharedgalleryimageversions_get) +- [List](#sharedgalleryimageversions_list) + +## SharedGalleryImages + +- [Get](#sharedgalleryimages_get) +- [List](#sharedgalleryimages_list) + +## Snapshots + +- [CreateOrUpdate](#snapshots_createorupdate) +- [Delete](#snapshots_delete) +- [GetByResourceGroup](#snapshots_getbyresourcegroup) +- [GrantAccess](#snapshots_grantaccess) +- [List](#snapshots_list) +- [ListByResourceGroup](#snapshots_listbyresourcegroup) +- [RevokeAccess](#snapshots_revokeaccess) +- [Update](#snapshots_update) + +## SshPublicKeys + +- [Create](#sshpublickeys_create) +- [Delete](#sshpublickeys_delete) +- [GenerateKeyPair](#sshpublickeys_generatekeypair) +- [GetByResourceGroup](#sshpublickeys_getbyresourcegroup) +- [List](#sshpublickeys_list) +- [ListByResourceGroup](#sshpublickeys_listbyresourcegroup) +- [Update](#sshpublickeys_update) + +## Usage + +- [List](#usage_list) + +## VirtualMachineExtensionImages + +- [Get](#virtualmachineextensionimages_get) +- [ListTypes](#virtualmachineextensionimages_listtypes) +- [ListVersions](#virtualmachineextensionimages_listversions) + +## VirtualMachineExtensions + +- [CreateOrUpdate](#virtualmachineextensions_createorupdate) +- [Delete](#virtualmachineextensions_delete) +- [Get](#virtualmachineextensions_get) +- [List](#virtualmachineextensions_list) +- [Update](#virtualmachineextensions_update) + +## VirtualMachineImages + +- [Get](#virtualmachineimages_get) +- [List](#virtualmachineimages_list) +- [ListOffers](#virtualmachineimages_listoffers) +- [ListPublishers](#virtualmachineimages_listpublishers) +- [ListSkus](#virtualmachineimages_listskus) + +## VirtualMachineImagesEdgeZone + +- [Get](#virtualmachineimagesedgezone_get) +- [List](#virtualmachineimagesedgezone_list) +- [ListOffers](#virtualmachineimagesedgezone_listoffers) +- [ListPublishers](#virtualmachineimagesedgezone_listpublishers) +- [ListSkus](#virtualmachineimagesedgezone_listskus) + +## VirtualMachineRunCommands + +- [CreateOrUpdate](#virtualmachineruncommands_createorupdate) +- [Delete](#virtualmachineruncommands_delete) +- [Get](#virtualmachineruncommands_get) +- [GetByVirtualMachine](#virtualmachineruncommands_getbyvirtualmachine) +- [List](#virtualmachineruncommands_list) +- [ListByVirtualMachine](#virtualmachineruncommands_listbyvirtualmachine) +- [Update](#virtualmachineruncommands_update) + +## VirtualMachineScaleSetExtensions + +- [CreateOrUpdate](#virtualmachinescalesetextensions_createorupdate) +- [Delete](#virtualmachinescalesetextensions_delete) +- [Get](#virtualmachinescalesetextensions_get) +- [List](#virtualmachinescalesetextensions_list) +- [Update](#virtualmachinescalesetextensions_update) + +## VirtualMachineScaleSetRollingUpgrades + +- [Cancel](#virtualmachinescalesetrollingupgrades_cancel) +- [GetLatest](#virtualmachinescalesetrollingupgrades_getlatest) +- [StartExtensionUpgrade](#virtualmachinescalesetrollingupgrades_startextensionupgrade) +- [StartOSUpgrade](#virtualmachinescalesetrollingupgrades_startosupgrade) + +## VirtualMachineScaleSetVMExtensions + +- [CreateOrUpdate](#virtualmachinescalesetvmextensions_createorupdate) +- [Delete](#virtualmachinescalesetvmextensions_delete) +- [Get](#virtualmachinescalesetvmextensions_get) +- [List](#virtualmachinescalesetvmextensions_list) +- [Update](#virtualmachinescalesetvmextensions_update) + +## VirtualMachineScaleSetVMRunCommands + +- [CreateOrUpdate](#virtualmachinescalesetvmruncommands_createorupdate) +- [Delete](#virtualmachinescalesetvmruncommands_delete) +- [Get](#virtualmachinescalesetvmruncommands_get) +- [List](#virtualmachinescalesetvmruncommands_list) +- [Update](#virtualmachinescalesetvmruncommands_update) + +## VirtualMachineScaleSetVMs + +- [Deallocate](#virtualmachinescalesetvms_deallocate) +- [Delete](#virtualmachinescalesetvms_delete) +- [Get](#virtualmachinescalesetvms_get) +- [GetInstanceView](#virtualmachinescalesetvms_getinstanceview) +- [List](#virtualmachinescalesetvms_list) +- [PerformMaintenance](#virtualmachinescalesetvms_performmaintenance) +- [PowerOff](#virtualmachinescalesetvms_poweroff) +- [Redeploy](#virtualmachinescalesetvms_redeploy) +- [Reimage](#virtualmachinescalesetvms_reimage) +- [ReimageAll](#virtualmachinescalesetvms_reimageall) +- [Restart](#virtualmachinescalesetvms_restart) +- [RetrieveBootDiagnosticsData](#virtualmachinescalesetvms_retrievebootdiagnosticsdata) +- [RunCommand](#virtualmachinescalesetvms_runcommand) +- [SimulateEviction](#virtualmachinescalesetvms_simulateeviction) +- [Start](#virtualmachinescalesetvms_start) +- [Update](#virtualmachinescalesetvms_update) + +## VirtualMachineScaleSets + +- [ConvertToSinglePlacementGroup](#virtualmachinescalesets_converttosingleplacementgroup) +- [CreateOrUpdate](#virtualmachinescalesets_createorupdate) +- [Deallocate](#virtualmachinescalesets_deallocate) +- [Delete](#virtualmachinescalesets_delete) +- [DeleteInstances](#virtualmachinescalesets_deleteinstances) +- [ForceRecoveryServiceFabricPlatformUpdateDomainWalk](#virtualmachinescalesets_forcerecoveryservicefabricplatformupdatedomainwalk) +- [GetByResourceGroup](#virtualmachinescalesets_getbyresourcegroup) +- [GetInstanceView](#virtualmachinescalesets_getinstanceview) +- [GetOSUpgradeHistory](#virtualmachinescalesets_getosupgradehistory) +- [List](#virtualmachinescalesets_list) +- [ListByLocation](#virtualmachinescalesets_listbylocation) +- [ListByResourceGroup](#virtualmachinescalesets_listbyresourcegroup) +- [ListSkus](#virtualmachinescalesets_listskus) +- [PerformMaintenance](#virtualmachinescalesets_performmaintenance) +- [PowerOff](#virtualmachinescalesets_poweroff) +- [Redeploy](#virtualmachinescalesets_redeploy) +- [Reimage](#virtualmachinescalesets_reimage) +- [ReimageAll](#virtualmachinescalesets_reimageall) +- [Restart](#virtualmachinescalesets_restart) +- [SetOrchestrationServiceState](#virtualmachinescalesets_setorchestrationservicestate) +- [Start](#virtualmachinescalesets_start) +- [Update](#virtualmachinescalesets_update) +- [UpdateInstances](#virtualmachinescalesets_updateinstances) + +## VirtualMachineSizes + +- [List](#virtualmachinesizes_list) + +## VirtualMachines + +- [AssessPatches](#virtualmachines_assesspatches) +- [Capture](#virtualmachines_capture) +- [ConvertToManagedDisks](#virtualmachines_converttomanageddisks) +- [CreateOrUpdate](#virtualmachines_createorupdate) +- [Deallocate](#virtualmachines_deallocate) +- [Delete](#virtualmachines_delete) +- [Generalize](#virtualmachines_generalize) +- [GetByResourceGroup](#virtualmachines_getbyresourcegroup) +- [InstallPatches](#virtualmachines_installpatches) +- [InstanceView](#virtualmachines_instanceview) +- [List](#virtualmachines_list) +- [ListAvailableSizes](#virtualmachines_listavailablesizes) +- [ListByLocation](#virtualmachines_listbylocation) +- [ListByResourceGroup](#virtualmachines_listbyresourcegroup) +- [PerformMaintenance](#virtualmachines_performmaintenance) +- [PowerOff](#virtualmachines_poweroff) +- [Reapply](#virtualmachines_reapply) +- [Redeploy](#virtualmachines_redeploy) +- [Reimage](#virtualmachines_reimage) +- [Restart](#virtualmachines_restart) +- [RetrieveBootDiagnosticsData](#virtualmachines_retrievebootdiagnosticsdata) +- [RunCommand](#virtualmachines_runcommand) +- [SimulateEviction](#virtualmachines_simulateeviction) +- [Start](#virtualmachines_start) +- [Update](#virtualmachines_update) +### AvailabilitySets_CreateOrUpdate + +```java +/** Samples for AvailabilitySets CreateOrUpdate. */ +public final class AvailabilitySetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnAvailabilitySet.json + */ + /** + * Sample code: Create an availability set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnAvailabilitySet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .availabilitySets() + .define("myAvailabilitySet") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlatformUpdateDomainCount(20) + .withPlatformFaultDomainCount(2) + .create(); + } +} +``` + +### AvailabilitySets_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets Delete. */ +public final class AvailabilitySetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().deleteWithResponse("rgcompute", "aaaaaaaaaaa", Context.NONE); + } +} +``` + +### AvailabilitySets_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets GetByResourceGroup. */ +public final class AvailabilitySetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Get_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaa", Context.NONE); + } +} +``` + +### AvailabilitySets_List + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets List. */ +public final class AvailabilitySetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListAvailabilitySetsInASubscription.json + */ + /** + * Sample code: List availability sets in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAvailabilitySetsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().list("virtualMachines\\$ref", Context.NONE); + } +} +``` + +### AvailabilitySets_ListAvailableSizes + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListAvailableSizes. */ +public final class AvailabilitySetsListAvailableSizesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_ListAvailableSizes_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_ListAvailableSizes_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListAvailableSizesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listAvailableSizes("rgcompute", "aa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_ListAvailableSizes_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_ListAvailableSizes_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListAvailableSizesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listAvailableSizes("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### AvailabilitySets_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListByResourceGroup. */ +public final class AvailabilitySetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_List_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_List_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listByResourceGroup("rgcompute", Context.NONE); + } +} +``` + +### AvailabilitySets_Update + +```java +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySet; +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AvailabilitySets Update. */ +public final class AvailabilitySetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Update_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaa", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key2574", "aaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .withPlatformUpdateDomainCount(20) + .withPlatformFaultDomainCount(2) + .withVirtualMachines( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withProximityPlacementGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .apply(); + } + + @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; + } +} +``` + +### CapacityReservationGroups_CreateOrUpdate + +```java +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservationGroups CreateOrUpdate. */ +public final class CapacityReservationGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateACapacityReservationGroup.json + */ + /** + * Sample code: Create or update a capacity reservation group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateACapacityReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .define("myCapacityReservationGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1", "2")) + .create(); + } + + @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; + } +} +``` + +### CapacityReservationGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CapacityReservationGroups Delete. */ +public final class CapacityReservationGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservationGroups().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservationGroups().deleteWithResponse("rgcompute", "a", Context.NONE); + } +} +``` + +### CapacityReservationGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CapacityReservationGroups GetByResourceGroup. */ +public final class CapacityReservationGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetACapacityReservationGroup.json + */ + /** + * Sample code: Get a capacity reservation Group. + * + * @param manager Entry point to ComputeManager. + */ + public static void getACapacityReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myCapacityReservationGroup", null, Context.NONE); + } +} +``` + +### CapacityReservationGroups_List + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups List. */ +public final class CapacityReservationGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationGroupsInSubscription.json + */ + /** + * Sample code: List capacity reservation groups in subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationGroupsInSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .list(ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} +``` + +### CapacityReservationGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups ListByResourceGroup. */ +public final class CapacityReservationGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationGroupsInResourceGroup.json + */ + /** + * Sample code: List capacity reservation groups in resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationGroupsInResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .listByResourceGroup( + "myResourceGroup", ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} +``` + +### CapacityReservationGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservationGroups Update. */ +public final class CapacityReservationGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservationGroup resource = + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key5355", "aaa")).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Update_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservationGroup resource = + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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; + } +} +``` + +### CapacityReservations_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservations CreateOrUpdate. */ +public final class CapacityReservationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateACapacityReservation.json + */ + /** + * Sample code: Create or update a capacity reservation . + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateACapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .define("myCapacityReservation") + .withRegion("westus") + .withExistingCapacityReservationGroup("myResourceGroup", "myCapacityReservationGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withCapacity(4L)) + .withTags(mapOf("department", "HR")) + .withZones(Arrays.asList("1")) + .create(); + } + + @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; + } +} +``` + +### CapacityReservations_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CapacityReservations Delete. */ +public final class CapacityReservationsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservations().delete("rgcompute", "aaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservations().delete("rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### CapacityReservations_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CapacityReservations Get. */ +public final class CapacityReservationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetACapacityReservation.json + */ + /** + * Sample code: Get a capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void getACapacityReservation(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .getWithResponse( + "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", null, Context.NONE); + } +} +``` + +### CapacityReservations_ListByCapacityReservationGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CapacityReservations ListByCapacityReservationGroup. */ +public final class CapacityReservationsListByCapacityReservationGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationsInReservationGroup.json + */ + /** + * Sample code: List capacity reservations in reservation group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationsInReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .listByCapacityReservationGroup("myResourceGroup", "myCapacityReservationGroup", Context.NONE); + } +} +``` + +### CapacityReservations_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CapacityReservation; +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservations Update. */ +public final class CapacityReservationsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Update_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservation resource = + manager + .capacityReservations() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservation resource = + manager + .capacityReservations() + .getWithResponse("rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key4974", "aaaaaaaaaaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .apply(); + } + + @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; + } +} +``` + +### CloudServiceOperatingSystems_GetOSFamily + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSFamily. */ +public final class CloudServiceOperatingSystemsGetOSFamilySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSFamily.json + */ + /** + * Sample code: Get Cloud Service OS Family. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceOSFamily(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().getOSFamilyWithResponse("westus2", "3", Context.NONE); + } +} +``` + +### CloudServiceOperatingSystems_GetOSVersion + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSVersion. */ +public final class CloudServiceOperatingSystemsGetOSVersionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSVersion.json + */ + /** + * Sample code: Get Cloud Service OS Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceOSVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceOperatingSystems() + .getOSVersionWithResponse("westus2", "WA-GUEST-OS-3.90_202010-02", Context.NONE); + } +} +``` + +### CloudServiceOperatingSystems_ListOSFamilies + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSFamilies. */ +public final class CloudServiceOperatingSystemsListOSFamiliesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSFamilies.json + */ + /** + * Sample code: List Cloud Service OS Families in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServiceOSFamiliesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().listOSFamilies("westus2", Context.NONE); + } +} +``` + +### CloudServiceOperatingSystems_ListOSVersions + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSVersions. */ +public final class CloudServiceOperatingSystemsListOSVersionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSVersions.json + */ + /** + * Sample code: List Cloud Service OS Versions in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServiceOSVersionsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().listOSVersions("westus2", Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Delete. */ +public final class CloudServiceRoleInstancesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstance.json + */ + /** + * Sample code: Delete Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().delete("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Get. */ +public final class CloudServiceRoleInstancesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceRoleInstance(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceRoleInstances() + .getWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", null, Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_GetInstanceView + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances GetInstanceView. */ +public final class CloudServiceRoleInstancesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetInstanceViewOfCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Instance View of Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInstanceViewOfCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceRoleInstances() + .getInstanceViewWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_List + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances List. */ +public final class CloudServiceRoleInstancesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRolesInstances.json + */ + /** + * Sample code: List Role Instances in a Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRoleInstancesInACloudService( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().list("ConstosoRG", "{cs-name}", null, Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_Rebuild + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Rebuild. */ +public final class CloudServiceRoleInstancesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstance.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void rebuildCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().rebuild("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_Reimage + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Reimage. */ +public final class CloudServiceRoleInstancesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstance.json + */ + /** + * Sample code: Reimage Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().reimage("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoleInstances_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Restart. */ +public final class CloudServiceRoleInstancesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstance.json + */ + /** + * Sample code: Restart Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().restart("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoles_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles Get. */ +public final class CloudServiceRolesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRole.json + */ + /** + * Sample code: Get Cloud Service Role. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceRole(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoles().getWithResponse("{role-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServiceRoles_List + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles List. */ +public final class CloudServiceRolesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRoles.json + */ + /** + * Sample code: List Roles in a Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRolesInACloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoles().list("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_CreateOrUpdate + +```java +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.CloudServiceExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceExtensionProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceOsProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProfileProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleSku; +import com.azure.resourcemanager.compute.generated.models.CloudServiceUpgradeMode; +import com.azure.resourcemanager.compute.generated.models.CloudServiceVaultCertificate; +import com.azure.resourcemanager.compute.generated.models.CloudServiceVaultSecretGroup; +import com.azure.resourcemanager.compute.generated.models.Extension; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerConfiguration; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerConfigurationProperties; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerFrontendIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerFrontendIpConfigurationProperties; +import java.util.Arrays; + +/** Samples for CloudServices CreateOrUpdate. */ +public final class CloudServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRole.json + */ + /** + * Sample code: Create New Cloud Service with Single Role. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRole( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("myLoadBalancer") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("myfe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP")))))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndCertificate.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and Certificate from Key Vault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withOsProfile( + new CloudServiceOsProfile() + .withSecrets( + Arrays + .asList( + new CloudServiceVaultSecretGroup() + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}")) + .withVaultCertificates( + Arrays + .asList( + new CloudServiceVaultCertificate() + .withCertificateUrl( + "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}")))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndRDP.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and RDP Extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRoleAndRDPExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"))))))))) + .withExtensionProfile( + new CloudServiceExtensionProfile() + .withExtensions( + Arrays + .asList( + new Extension() + .withName("RDPExtension") + .withProperties( + new CloudServiceExtensionProperties() + .withPublisher("Microsoft.Windows.Azure.Extensions") + .withType("RDP") + .withTypeHandlerVersion("1.2.1") + .withAutoUpgradeMinorVersion(false) + .withSettings( + "UserAzure10/22/2021" + + " 15:05:45") + .withProtectedSettings( + "{password}")))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithMultiRole.json + */ + /** + * Sample code: Create New Cloud Service with Multiple Roles. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithMultipleRoles( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L)), + new CloudServiceRoleProfileProperties() + .withName("ContosoBackend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))) + .create(); + } +} +``` + +### CloudServices_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices Delete. */ +public final class CloudServicesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudService.json + */ + /** + * Sample code: Delete Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().delete("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_DeleteInstances + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices DeleteInstances. */ +public final class CloudServicesDeleteInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstances.json + */ + /** + * Sample code: Delete Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .deleteInstances( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} +``` + +### CloudServices_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices GetByResourceGroup. */ +public final class CloudServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceWithMultiRoleAndRDP.json + */ + /** + * Sample code: Get Cloud Service with Multiple Roles and RDP Extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceWithMultipleRolesAndRDPExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().getByResourceGroupWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_GetInstanceView + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices GetInstanceView. */ +public final class CloudServicesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceInstanceViewWithMultiRole.json + */ + /** + * Sample code: Get Cloud Service Instance View with Multiple Roles. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceInstanceViewWithMultipleRoles( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().getInstanceViewWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_List + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices List. */ +public final class CloudServicesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInSubscription.json + */ + /** + * Sample code: List Cloud Services in a Subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServicesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().list(Context.NONE); + } +} +``` + +### CloudServices_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices ListByResourceGroup. */ +public final class CloudServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInResourceGroup.json + */ + /** + * Sample code: List Cloud Services in a Resource Group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServicesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().listByResourceGroup("ConstosoRG", Context.NONE); + } +} +``` + +### CloudServices_PowerOff + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices PowerOff. */ +public final class CloudServicesPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/PowerOffCloudService.json + */ + /** + * Sample code: Stop or PowerOff Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void stopOrPowerOffCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().powerOff("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_Rebuild + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Rebuild. */ +public final class CloudServicesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstances.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void rebuildCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .rebuild( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} +``` + +### CloudServices_Reimage + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Reimage. */ +public final class CloudServicesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstances.json + */ + /** + * Sample code: Reimage Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .reimage( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} +``` + +### CloudServices_Restart + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Restart. */ +public final class CloudServicesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstances.json + */ + /** + * Sample code: Restart Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .restart( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} +``` + +### CloudServices_Start + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServices Start. */ +public final class CloudServicesStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/StartCloudService.json + */ + /** + * Sample code: Start Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void startCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().start("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServices_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CloudService; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudServices Update. */ +public final class CloudServicesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceToIncludeTags.json + */ + /** + * Sample code: Update existing Cloud Service to add tags. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateExistingCloudServiceToAddTags( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CloudService resource = + manager.cloudServices().getByResourceGroupWithResponse("ConstosoRG", "{cs-name}", Context.NONE).getValue(); + resource.update().withTags(mapOf("Documentation", "RestAPI")).apply(); + } + + @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; + } +} +``` + +### CloudServicesUpdateDomain_GetUpdateDomain + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain GetUpdateDomain. */ +public final class CloudServicesUpdateDomainGetUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceUpdateDomain.json + */ + /** + * Sample code: Get Cloud Service Update Domain. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceUpdateDomain(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().getUpdateDomainWithResponse("ConstosoRG", "{cs-name}", 1, Context.NONE); + } +} +``` + +### CloudServicesUpdateDomain_ListUpdateDomains + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain ListUpdateDomains. */ +public final class CloudServicesUpdateDomainListUpdateDomainsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceUpdateDomains.json + */ + /** + * Sample code: List Update Domains in Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listUpdateDomainsInCloudService( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().listUpdateDomains("ConstosoRG", "{cs-name}", Context.NONE); + } +} +``` + +### CloudServicesUpdateDomain_WalkUpdateDomain + +```java +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain WalkUpdateDomain. */ +public final class CloudServicesUpdateDomainWalkUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceUpdateDomain.json + */ + /** + * Sample code: Update Cloud Service to specified Domain. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateCloudServiceToSpecifiedDomain( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().walkUpdateDomain("ConstosoRG", "{cs-name}", 1, null, Context.NONE); + } +} +``` + +### CommunityGalleries_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CommunityGalleries Get. */ +public final class CommunityGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.communityGalleries().getWithResponse("myLocation", "publicGalleryName", Context.NONE); + } +} +``` + +### CommunityGalleryImageVersions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImageVersions Get. */ +public final class CommunityGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .communityGalleryImageVersions() + .getWithResponse( + "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} +``` + +### CommunityGalleryImages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImages Get. */ +public final class CommunityGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .communityGalleryImages() + .getWithResponse("myLocation", "publicGalleryName", "myGalleryImageName", Context.NONE); + } +} +``` + +### DedicatedHostGroups_CreateOrUpdate + +```java +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHostGroups CreateOrUpdate. */ +public final class DedicatedHostGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateADedicatedHostGroup.json + */ + /** + * Sample code: Create or update a dedicated host group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateADedicatedHostGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHostGroups() + .define("myDedicatedHostGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1")) + .withPlatformFaultDomainCount(3) + .withSupportAutomaticPlacement(true) + .create(); + } + + @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; + } +} +``` + +### DedicatedHostGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups Delete. */ +public final class DedicatedHostGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().deleteWithResponse("rgcompute", "aaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().deleteWithResponse("rgcompute", "a", Context.NONE); + } +} +``` + +### DedicatedHostGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups GetByResourceGroup. */ +public final class DedicatedHostGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetADedicatedHostGroup.json + */ + /** + * Sample code: Create a dedicated host group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADedicatedHostGroup(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myDedicatedHostGroup", null, Context.NONE); + } +} +``` + +### DedicatedHostGroups_List + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups List. */ +public final class DedicatedHostGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListBySubscription_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListBySubscriptionMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().list(Context.NONE); + } +} +``` + +### DedicatedHostGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups ListByResourceGroup. */ +public final class DedicatedHostGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListByResourceGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().listByResourceGroup("rgcompute", Context.NONE); + } +} +``` + +### DedicatedHostGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroup; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHostGroups Update. */ +public final class DedicatedHostGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Update_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHostGroup resource = + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Update_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHostGroup resource = + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key9921", "aaaaaaaaaa")) + .withZones(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .withPlatformFaultDomainCount(3) + .withSupportAutomaticPlacement(true) + .apply(); + } + + @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; + } +} +``` + +### DedicatedHosts_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHosts CreateOrUpdate. */ +public final class DedicatedHostsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateADedicatedHost.json + */ + /** + * Sample code: Create or update a dedicated host . + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateADedicatedHost( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHosts() + .define("myDedicatedHost") + .withRegion("westus") + .withExistingHostGroup("myResourceGroup", "myDedicatedHostGroup") + .withSku(new Sku().withName("DSv3-Type1")) + .withTags(mapOf("department", "HR")) + .withPlatformFaultDomain(1) + .create(); + } + + @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; + } +} +``` + +### DedicatedHosts_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Delete. */ +public final class DedicatedHostsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().delete("rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().delete("rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", Context.NONE); + } +} +``` + +### DedicatedHosts_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Get. */ +public final class DedicatedHostsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetADedicatedHost.json + */ + /** + * Sample code: Get a dedicated host. + * + * @param manager Entry point to ComputeManager. + */ + public static void getADedicatedHost(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHosts() + .getWithResponse("myResourceGroup", "myDedicatedHostGroup", "myHost", null, Context.NONE); + } +} +``` + +### DedicatedHosts_ListByHostGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts ListByHostGroup. */ +public final class DedicatedHostsListByHostGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_ListByHostGroup_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_ListByHostGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsListByHostGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().listByHostGroup("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_ListByHostGroup_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_ListByHostGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsListByHostGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().listByHostGroup("rgcompute", "aaaa", Context.NONE); + } +} +``` + +### DedicatedHosts_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Restart. */ +public final class DedicatedHostsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostRestart.json + */ + /** + * Sample code: Restart Dedicated Host. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartDedicatedHost(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().restart("myResourceGroup", "myDedicatedHostGroup", "myHost", Context.NONE); + } +} +``` + +### DedicatedHosts_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DedicatedHost; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostLicenseTypes; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHosts Update. */ +public final class DedicatedHostsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Update_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHost resource = + manager + .dedicatedHosts() + .getWithResponse("rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key8813", "aaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .withPlatformFaultDomain(1) + .withAutoReplaceOnFailure(true) + .withLicenseType(DedicatedHostLicenseTypes.WINDOWS_SERVER_HYBRID) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Update_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHost resource = + manager + .dedicatedHosts() + .getWithResponse("rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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; + } +} +``` + +### DiskAccesses_CreateOrUpdate + +```java +/** Samples for DiskAccesses CreateOrUpdate. */ +public final class DiskAccessesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskAccess.json + */ + /** + * Sample code: Create a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .define("myDiskAccess") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .create(); + } +} +``` + +### DiskAccesses_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses Delete. */ +public final class DiskAccessesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteADiskAccess.json + */ + /** + * Sample code: Delete a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().delete("myResourceGroup", "myDiskAccess", Context.NONE); + } +} +``` + +### DiskAccesses_DeleteAPrivateEndpointConnection + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses DeleteAPrivateEndpointConnection. */ +public final class DiskAccessesDeleteAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteAPrivateEndpointConnection.json + */ + /** + * Sample code: Delete a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .deleteAPrivateEndpointConnection( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} +``` + +### DiskAccesses_GetAPrivateEndpointConnection + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetAPrivateEndpointConnection. */ +public final class DiskAccessesGetAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutAPrivateEndpointConnection.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .getAPrivateEndpointConnectionWithResponse( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} +``` + +### DiskAccesses_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetByResourceGroup. */ +public final class DiskAccessesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskAccess.json + */ + /** + * Sample code: Get information about a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskAccessWithPrivateEndpoints.json + */ + /** + * Sample code: Get information about a disk access resource with private endpoints. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskAccessResourceWithPrivateEndpoints( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} +``` + +### DiskAccesses_GetPrivateLinkResources + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetPrivateLinkResources. */ +public final class DiskAccessesGetPrivateLinkResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskAccessPrivateLinkResources.json + */ + /** + * Sample code: List all possible private link resources under disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllPossiblePrivateLinkResourcesUnderDiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getPrivateLinkResourcesWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} +``` + +### DiskAccesses_List + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses List. */ +public final class DiskAccessesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskAccessesInASubscription.json + */ + /** + * Sample code: List all disk access resources in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskAccessResourcesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().list(Context.NONE); + } +} +``` + +### DiskAccesses_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListByResourceGroup. */ +public final class DiskAccessesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskAccessesInAResourceGroup.json + */ + /** + * Sample code: List all disk access resources in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskAccessResourcesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### DiskAccesses_ListPrivateEndpointConnections + +```java +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListPrivateEndpointConnections. */ +public final class DiskAccessesListPrivateEndpointConnectionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListPrivateEndpointConnectionsInADiskAccess.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().listPrivateEndpointConnections("myResourceGroup", "myDiskAccess", Context.NONE); + } +} +``` + +### DiskAccesses_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DiskAccess; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskAccesses Update. */ +public final class DiskAccessesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskAccess.json + */ + /** + * Sample code: Update a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskAccess resource = + manager + .diskAccesses() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Development", "project", "PrivateEndpoints")).apply(); + } + + @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; + } +} +``` + +### DiskAccesses_UpdateAPrivateEndpointConnection + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkServiceConnectionState; + +/** Samples for DiskAccesses UpdateAPrivateEndpointConnection. */ +public final class DiskAccessesUpdateAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ApprovePrivateEndpointConnection.json + */ + /** + * Sample code: Approve a Private Endpoint Connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void approveAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .updateAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approving myPrivateEndpointConnection")), + Context.NONE); + } +} +``` + +### DiskEncryptionSets_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.SourceVault; + +/** Samples for DiskEncryptionSets CreateOrUpdate. */ +public final class DiskEncryptionSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskEncryptionSet.json + */ + /** + * Sample code: Create a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .define("myDiskEncryptionSet") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/{key}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskEncryptionSetWithKeyVaultFromADifferentSubscription.json + */ + /** + * Sample code: Create a disk encryption set with key vault from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskEncryptionSetWithKeyVaultFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .define("myDiskEncryptionSet") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}")) + .create(); + } +} +``` + +### DiskEncryptionSets_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets Delete. */ +public final class DiskEncryptionSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteADiskEncryptionSet.json + */ + /** + * Sample code: Delete a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().delete("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} +``` + +### DiskEncryptionSets_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets GetByResourceGroup. */ +public final class DiskEncryptionSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskEncryptionSet.json + */ + /** + * Sample code: Get information about a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskEncryptionSetWithAutoKeyRotationError.json + */ + /** + * Sample code: Get information about a disk encryption set when auto-key rotation failed. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} +``` + +### DiskEncryptionSets_List + +```java +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets List. */ +public final class DiskEncryptionSetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetsInASubscription.json + */ + /** + * Sample code: List all disk encryption sets in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskEncryptionSetsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().list(Context.NONE); + } +} +``` + +### DiskEncryptionSets_ListAssociatedResources + +```java +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListAssociatedResources. */ +public final class DiskEncryptionSetsListAssociatedResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetAssociatedResources.json + */ + /** + * Sample code: List all resources that are encrypted with this disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().listAssociatedResources("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} +``` + +### DiskEncryptionSets_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListByResourceGroup. */ +public final class DiskEncryptionSetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ + /** + * Sample code: List all disk encryption sets in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskEncryptionSetsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### DiskEncryptionSets_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.SourceVault; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskEncryptionSets Update. */ +public final class DiskEncryptionSetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabled.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Succeeded. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledInProgress.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Updating. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSet.json + */ + /** + * Sample code: Update a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "Encryption")) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion")) + .apply(); + } + + @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; + } +} +``` + +### DiskRestorePoint_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint Get. */ +public final class DiskRestorePointGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskRestorePointWhenSourceResourceIsFromDifferentRegion.json + */ + /** + * Sample code: Get an incremental disk restorePoint when source resource is from a different region. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .getWithResponse( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskRestorePointResources.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .getWithResponse( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} +``` + +### DiskRestorePoint_GrantAccess + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for DiskRestorePoint GrantAccess. */ +public final class DiskRestorePointGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Grants access to a diskRestorePoint. + * + * @param manager Entry point to ComputeManager. + */ + public static void grantsAccessToADiskRestorePoint( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .grantAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} +``` + +### DiskRestorePoint_ListByRestorePoint + +```java +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint ListByRestorePoint. */ +public final class DiskRestorePointListByRestorePointSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskRestorePointsInVmRestorePoint.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskRestorePoints().listByRestorePoint("myResourceGroup", "rpc", "vmrp", Context.NONE); + } +} +``` + +### DiskRestorePoint_RevokeAccess + +```java +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint RevokeAccess. */ +public final class DiskRestorePointRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Revokes access to a diskRestorePoint. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokesAccessToADiskRestorePoint( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .revokeAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} +``` + +### Disks_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOption; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityTypes; +import com.azure.resourcemanager.compute.generated.models.DiskSku; +import com.azure.resourcemanager.compute.generated.models.DiskStorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocationTypes; +import com.azure.resourcemanager.compute.generated.models.ImageDiskReference; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for Disks CreateOrUpdate. */ +public final class DisksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromImportSecure.json + */ + /** + * Sample code: Create a managed disk from ImportSecure create option. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromImportSecureCreateOption( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT_SECURE) + .withStorageAccountId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withSecurityDataUri("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd")) + .withSecurityProfile( + new DiskSecurityProfile() + .withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithDiskAccess.json + */ + /** + * Sample code: Create a managed disk and associate with disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskAndAssociateWithDiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_PRIVATE) + .withDiskAccessId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a managed disk and associate with disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskAndAssociateWithDiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withEncryption( + new Encryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ + /** + * Sample code: Create a managed disk from an existing managed disk in the same or different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithSecurityProfile.json + */ + /** + * Sample code: Create a managed disk with security profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskWithSecurityProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("North Central US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"))) + .withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithLogicalSectorSize.json + */ + /** + * Sample code: Create an ultra managed disk with logicalSectorSize 512E. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnUltraManagedDiskWithLogicalSectorSize512E( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.ULTRA_SSD_LRS)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY).withLogicalSectorSize(512)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ + /** + * Sample code: Create a managed disk from a platform image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromAPlatformImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAnEmptyManagedDisk.json + */ + /** + * Sample code: Create an empty managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnEmptyManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from the same subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromUploadPreparedSecure.json + */ + /** + * Sample code: Create a managed disk from UploadPreparedSecure create option. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromUploadPreparedSecureCreateOption( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.UPLOAD_PREPARED_SECURE) + .withUploadSizeBytes(10737418752L)) + .withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ + /** + * Sample code: Create a managed disk by copying a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByCopyingASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAConfidentialVMDiskEncryptedWithCMK.json + */ + /** + * Sample code: Create a confidential VM supported disk encrypted with customer managed key. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))) + .withSecurityProfile( + new DiskSecurityProfile() + .withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_CUSTOMER_KEY) + .withSecureVMDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithSSDZRSAccountType.json + */ + /** + * Sample code: Create a managed disk with ssd zrs account type. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskWithSsdZrsAccountType( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.PREMIUM_ZRS)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAnEmptyManagedDiskInExtendedLocation.json + */ + /** + * Sample code: Create an empty managed disk in extended location. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnEmptyManagedDiskInExtendedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation( + new ExtendedLocation().withName("{edge-zone-id}").withType(ExtendedLocationTypes.EDGE_ZONE)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedUploadDisk.json + */ + /** + * Sample code: Create a managed upload disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedUploadDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData().withCreateOption(DiskCreateOption.UPLOAD).withUploadSizeBytes(10737418752L)) + .create(); + } +} +``` + +### Disks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Disks Delete. */ +public final class DisksDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteAManagedDisk.json + */ + /** + * Sample code: Delete a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().delete("myResourceGroup", "myDisk", Context.NONE); + } +} +``` + +### Disks_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Disks GetByResourceGroup. */ +public final class DisksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutAManagedDisk.json + */ + /** + * Sample code: Get information about a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myManagedDisk", Context.NONE); + } +} +``` + +### Disks_GrantAccess + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for Disks GrantAccess. */ +public final class DisksGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessManagedDisk.json + */ + /** + * Sample code: Get a sas on a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void getASasOnAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .grantAccess( + "myResourceGroup", + "myDisk", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessManagedDiskWithVMGuestState.json + */ + /** + * Sample code: Get sas on managed disk and VM guest state. + * + * @param manager Entry point to ComputeManager. + */ + public static void getSasOnManagedDiskAndVMGuestState( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .grantAccess( + "myResourceGroup", + "myDisk", + new GrantAccessData() + .withAccess(AccessLevel.READ) + .withDurationInSeconds(300) + .withGetSecureVMGuestStateSas(true), + Context.NONE); + } +} +``` + +### Disks_List + +```java +import com.azure.core.util.Context; + +/** Samples for Disks List. */ +public final class DisksListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListManagedDisksInASubscription.json + */ + /** + * Sample code: List all managed disks in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllManagedDisksInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().list(Context.NONE); + } +} +``` + +### Disks_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Disks ListByResourceGroup. */ +public final class DisksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListManagedDisksInAResourceGroup.json + */ + /** + * Sample code: List all managed disks in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllManagedDisksInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### Disks_RevokeAccess + +```java +import com.azure.core.util.Context; + +/** Samples for Disks RevokeAccess. */ +public final class DisksRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessManagedDisk.json + */ + /** + * Sample code: Revoke access to a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokeAccessToAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().revokeAccess("myResourceGroup", "myDisk", Context.NONE); + } +} +``` + +### Disks_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Disk; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; + +/** Samples for Disks Update. */ +public final class DisksUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToDisableBursting.json + */ + /** + * Sample code: Update a managed disk to disable bursting. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToDisableBursting( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withBurstingEnabled(false).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddPurchasePlan.json + */ + /** + * Sample code: Update a managed disk to add purchase plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddPurchasePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource + .update() + .withPurchasePlan( + new PurchasePlanAutoGenerated() + .withName("myPurchasePlanName") + .withPublisher("myPurchasePlanPublisher") + .withProduct("myPurchasePlanProduct") + .withPromotionCode("myPurchasePlanPromotionCode")) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToChangeTier.json + */ + /** + * Sample code: Update a managed disk to change tier. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToChangeTier( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withTier("P30").apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateOrUpdateABurstingEnabledManagedDisk.json + */ + /** + * Sample code: Create or update a bursting enabled managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateABurstingEnabledManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withDiskSizeGB(1024).withBurstingEnabled(true).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddSupportsHibernation.json + */ + /** + * Sample code: Update a managed disk to add supportsHibernation. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddSupportsHibernation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withSupportsHibernation(true).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToRemoveDiskAccess.json + */ + /** + * Sample code: Update managed disk to remove disk access resource association. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateManagedDiskToRemoveDiskAccessResourceAssociation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_ALL).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddAcceleratedNetworking.json + */ + /** + * Sample code: Update a managed disk to add accelerated networking. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddAcceleratedNetworking( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)).apply(); + } +} +``` + +### Galleries_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.GallerySharingPermissionTypes; +import com.azure.resourcemanager.compute.generated.models.SharingProfile; +import com.azure.resourcemanager.compute.generated.models.SoftDeletePolicy; + +/** Samples for Galleries CreateOrUpdate. */ +public final class GalleriesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSharingProfile.json + */ + /** + * Sample code: Create or update a simple gallery with sharing profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryWithSharingProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .withSharingProfile(new SharingProfile().withPermissions(GallerySharingPermissionTypes.GROUPS)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGallery.json + */ + /** + * Sample code: Create or update a simple gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSoftDeletionEnabled.json + */ + /** + * Sample code: Create or update a simple gallery with soft deletion enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryWithSoftDeletionEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .withSoftDeletePolicy(new SoftDeletePolicy().withIsSoftDeleteEnabled(true)) + .create(); + } +} +``` + +### Galleries_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries Delete. */ +public final class GalleriesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGallery.json + */ + /** + * Sample code: Delete a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().delete("myResourceGroup", "myGalleryName", Context.NONE); + } +} +``` + +### Galleries_GetByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; + +/** Samples for Galleries GetByResourceGroup. */ +public final class GalleriesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryWithSelectPermissions.json + */ + /** + * Sample code: Get a gallery with select permissions. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryWithSelectPermissions( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .getByResourceGroupWithResponse( + "myResourceGroup", "myGalleryName", SelectPermissions.PERMISSIONS, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().getByResourceGroupWithResponse("myResourceGroup", "myGalleryName", null, Context.NONE); + } +} +``` + +### Galleries_List + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries List. */ +public final class GalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInASubscription.json + */ + /** + * Sample code: List galleries in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleriesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().list(Context.NONE); + } +} +``` + +### Galleries_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Galleries ListByResourceGroup. */ +public final class GalleriesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInAResourceGroup.json + */ + /** + * Sample code: List galleries in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleriesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### Galleries_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Gallery; + +/** Samples for Galleries Update. */ +public final class GalleriesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGallery.json + */ + /** + * Sample code: Update a simple gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Gallery resource = + manager + .galleries() + .getByResourceGroupWithResponse("myResourceGroup", "myGalleryName", null, Context.NONE) + .getValue(); + resource.update().withDescription("This is the gallery description.").apply(); + } +} +``` + +### GalleryApplicationVersions_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import com.azure.resourcemanager.compute.generated.models.UserArtifactManage; +import com.azure.resourcemanager.compute.generated.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions CreateOrUpdate. */ +public final class GalleryApplicationVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Create or update a simple gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingApplication("myResourceGroup", "myGalleryName", "myGalleryApplicationName") + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\"") + .withRemove("del C:\\package "))) + .create(); + } +} +``` + +### GalleryApplicationVersions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions Delete. */ +public final class GalleryApplicationVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplicationVersion.json + */ + /** + * Sample code: Delete a gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", Context.NONE); + } +} +``` + +### GalleryApplicationVersions_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; + +/** Samples for GalleryApplicationVersions Get. */ +public final class GalleryApplicationVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersion.json + */ + /** + * Sample code: Get a gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery Application Version with replication status. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplicationVersionWithReplicationStatus( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } +} +``` + +### GalleryApplicationVersions_ListByGalleryApplication + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions ListByGalleryApplication. */ +public final class GalleryApplicationVersionsListByGalleryApplicationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationVersionsInAGalleryApplication.json + */ + /** + * Sample code: List gallery Application Versions in a gallery Application Definition. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryApplicationVersionsInAGalleryApplicationDefinition( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .listByGalleryApplication("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} +``` + +### GalleryApplicationVersions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import com.azure.resourcemanager.compute.generated.models.UserArtifactManage; +import com.azure.resourcemanager.compute.generated.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions Update. */ +public final class GalleryApplicationVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Update a simple gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryApplicationVersion resource = + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\"") + .withRemove("del C:\\package "))) + .apply(); + } +} +``` + +### GalleryApplications_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryApplications CreateOrUpdate. */ +public final class GalleryApplicationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Create or update a simple gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryApplication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .define("myGalleryApplicationName") + .withRegion("West US") + .withExistingGallery("myResourceGroup", "myGalleryName") + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS) + .create(); + } +} +``` + +### GalleryApplications_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Delete. */ +public final class GalleryApplicationsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplication.json + */ + /** + * Sample code: Delete a gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryApplication(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} +``` + +### GalleryApplications_Get + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Get. */ +public final class GalleryApplicationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplication.json + */ + /** + * Sample code: Get a gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplication(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} +``` + +### GalleryApplications_ListByGallery + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryApplications ListByGallery. */ +public final class GalleryApplicationsListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationsInAGallery.json + */ + /** + * Sample code: List gallery Applications in a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryApplicationsInAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryApplications().listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} +``` + +### GalleryApplications_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryApplication; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryApplications Update. */ +public final class GalleryApplicationsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Update a simple gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryApplication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryApplication resource = + manager + .galleryApplications() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE) + .getValue(); + resource + .update() + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS) + .apply(); + } +} +``` + +### GalleryImageVersions_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.DataDiskImageEncryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionImages; +import com.azure.resourcemanager.compute.generated.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.generated.models.GalleryDataDiskImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryOSDiskImage; +import com.azure.resourcemanager.compute.generated.models.HostCaching; +import com.azure.resourcemanager.compute.generated.models.OSDiskImageEncryption; +import com.azure.resourcemanager.compute.generated.models.ReplicationMode; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions CreateOrUpdate. */ +public final class GalleryImageVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithShallowReplicationMode.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shallow replication mode. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays.asList(new TargetRegion().withName("West US").withRegionalReplicaCount(1))) + .withReplicationMode(ReplicationMode.SHALLOW)) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVHD.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using vhd as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVMAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using VM as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVMAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithImageVersionAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shared image as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using mix of disks and snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using managed image as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .create(); + } +} +``` + +### GalleryImageVersions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions Delete. */ +public final class GalleryImageVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImageVersion.json + */ + /** + * Sample code: Delete a gallery image version. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryImageVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", Context.NONE); + } +} +``` + +### GalleryImageVersions_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; + +/** Samples for GalleryImageVersions Get. */ +public final class GalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithVhdAsSource.json + */ + /** + * Sample code: Get a gallery image version with vhd as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithVhdAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery image version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery image version with replication status. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithReplicationStatus( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Get a gallery image version with snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } +} +``` + +### GalleryImageVersions_ListByGalleryImage + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions ListByGalleryImage. */ +public final class GalleryImageVersionsListByGalleryImageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImageVersionsInAGalleryImage.json + */ + /** + * Sample code: List gallery image versions in a gallery image definition. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryImageVersionsInAGalleryImageDefinition( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .listByGalleryImage("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} +``` + +### GalleryImageVersions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions Update. */ +public final class GalleryImageVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Update a simple Gallery Image Version (Managed Image as source). + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImageVersionManagedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImageVersion resource = + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersionWithoutSourceId.json + */ + /** + * Sample code: Update a simple Gallery Image Version without source id. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImageVersionWithoutSourceId( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImageVersion resource = + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile(new GalleryImageVersionStorageProfile()) + .apply(); + } +} +``` + +### GalleryImages_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryImages CreateOrUpdate. */ +public final class GalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImage.json + */ + /** + * Sample code: Create or update a simple gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImages() + .define("myGalleryImageName") + .withRegion("West US") + .withExistingGallery("myResourceGroup", "myGalleryName") + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .create(); + } +} +``` + +### GalleryImages_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryImages Delete. */ +public final class GalleryImagesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImage.json + */ + /** + * Sample code: Delete a gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().delete("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} +``` + +### GalleryImages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryImages Get. */ +public final class GalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImage.json + */ + /** + * Sample code: Get a gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} +``` + +### GalleryImages_ListByGallery + +```java +import com.azure.core.util.Context; + +/** Samples for GalleryImages ListByGallery. */ +public final class GalleryImagesListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImagesInAGallery.json + */ + /** + * Sample code: List gallery images in a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryImagesInAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} +``` + +### GalleryImages_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryImages Update. */ +public final class GalleryImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImage.json + */ + /** + * Sample code: Update a simple gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImage resource = + manager + .galleryImages() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE) + .getValue(); + resource + .update() + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .apply(); + } +} +``` + +### GallerySharingProfile_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroup; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroupTypes; +import com.azure.resourcemanager.compute.generated.models.SharingUpdateOperationTypes; +import java.util.Arrays; + +/** Samples for GallerySharingProfile Update. */ +public final class GallerySharingProfileUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ResetSharingProfileInAGallery.json + */ + /** + * Sample code: reset sharing profile of a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void resetSharingProfileOfAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .gallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner().withOperationType(SharingUpdateOperationTypes.RESET), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/AddToSharingProfileInAGallery.json + */ + /** + * Sample code: Add sharing id to the sharing profile of a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void addSharingIdToTheSharingProfileOfAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .gallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner() + .withOperationType(SharingUpdateOperationTypes.ADD) + .withGroups( + Arrays + .asList( + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.SUBSCRIPTIONS) + .withIds( + Arrays + .asList( + "34a4ab42-0d72-47d9-bd1a-aed207386dac", + "380fd389-260b-41aa-bad9-0a83108c370b")), + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.AADTENANTS) + .withIds(Arrays.asList("c24c76aa-8897-4027-9b03-8f7928b54ff6")))), + Context.NONE); + } +} +``` + +### Images_CreateOrUpdate + +```java +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageDataDisk; +import com.azure.resourcemanager.compute.generated.models.ImageOSDisk; +import com.azure.resourcemanager.compute.generated.models.ImageStorageProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import java.util.Arrays; + +/** Samples for Images CreateOrUpdate. */ +public final class ImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(false)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a blob with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromABlob.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a blob. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromABlob( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withBlobUri( + "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd") + .withLun(1))) + .withZoneResilient(false)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2")) + .withLun(1))) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromABlob.json + */ + /** + * Sample code: Create a virtual machine image from a blob. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromABlob( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAVM.json + */ + /** + * Sample code: Create a virtual machine image from an existing virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAnExistingVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2")) + .withLun(1))) + .withZoneResilient(false)) + .create(); + } +} +``` + +### Images_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Images Delete. */ +public final class ImagesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Images_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Images_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void imagesDeleteMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Images_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Images_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void imagesDeleteMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### Images_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Images GetByResourceGroup. */ +public final class ImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetInformationAboutAnImage.json + */ + /** + * Sample code: Get information about a virtual machine image. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAVirtualMachineImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().getByResourceGroupWithResponse("myResourceGroup", "myImage", null, Context.NONE); + } +} +``` + +### Images_List + +```java +import com.azure.core.util.Context; + +/** Samples for Images List. */ +public final class ImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListImagesInASubscription.json + */ + /** + * Sample code: List all virtual machine images in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllVirtualMachineImagesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().list(Context.NONE); + } +} +``` + +### Images_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Images ListByResourceGroup. */ +public final class ImagesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListImagesInAResourceGroup.json + */ + /** + * Sample code: List all virtual machine images in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllVirtualMachineImagesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### Images_Update + +```java +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.Image; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Images Update. */ +public final class ImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateImage.json + */ + /** + * Sample code: Updates tags of an Image. + * + * @param manager Entry point to ComputeManager. + */ + public static void updatesTagsOfAnImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Image resource = + manager + .images() + .getByResourceGroupWithResponse("myResourceGroup", "myImage", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "HR")) + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .withHyperVGeneration(HyperVGenerationTypes.V1) + .apply(); + } + + @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; + } +} +``` + +### LogAnalytics_ExportRequestRateByInterval + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.IntervalInMins; +import com.azure.resourcemanager.compute.generated.models.RequestRateByIntervalInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportRequestRateByInterval. */ +public final class LogAnalyticsExportRequestRateByIntervalSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/LogAnalyticsRequestRateByInterval.json + */ + /** + * Sample code: Export logs which contain all Api requests made to Compute Resource Provider within the given time + * period broken down by intervals. + * + * @param manager Entry point to ComputeManager. + */ + public static void + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .logAnalytics() + .exportRequestRateByInterval( + "westus", + new RequestRateByIntervalInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByResourceName(true) + .withIntervalLength(IntervalInMins.FIVE_MINS), + Context.NONE); + } +} +``` + +### LogAnalytics_ExportThrottledRequests + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ThrottledRequestsInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportThrottledRequests. */ +public final class LogAnalyticsExportThrottledRequestsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/LogAnalyticsThrottledRequests.json + */ + /** + * Sample code: Export logs which contain all throttled Api requests made to Compute Resource Provider within the + * given time period. + * + * @param manager Entry point to ComputeManager. + */ + public static void + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .logAnalytics() + .exportThrottledRequests( + "westus", + new ThrottledRequestsInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByOperationName(true) + .withGroupByResourceName(false) + .withGroupByClientApplicationId(false) + .withGroupByUserAgent(false), + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void operationsListMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.operations().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void operationsListMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### ProximityPlacementGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupType; + +/** Samples for ProximityPlacementGroups CreateOrUpdate. */ +public final class ProximityPlacementGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAProximityPlacementGroup.json + */ + /** + * Sample code: Create or Update a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .define("myProximityPlacementGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withProximityPlacementGroupType(ProximityPlacementGroupType.STANDARD) + .create(); + } +} +``` + +### ProximityPlacementGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups Delete. */ +public final class ProximityPlacementGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DeleteAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .deleteWithResponse("myResourceGroup", "myProximityPlacementGroup", Context.NONE); + } +} +``` + +### ProximityPlacementGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups GetByResourceGroup. */ +public final class ProximityPlacementGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myProximityPlacementGroup", null, Context.NONE); + } +} +``` + +### ProximityPlacementGroups_List + +```java +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups List. */ +public final class ProximityPlacementGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListProximityPlacementGroupsInASubscription.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.proximityPlacementGroups().list(Context.NONE); + } +} +``` + +### ProximityPlacementGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups ListByResourceGroup. */ +public final class ProximityPlacementGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListProximityPlacementGroupsInAResourceGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.proximityPlacementGroups().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### ProximityPlacementGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProximityPlacementGroups Update. */ +public final class ProximityPlacementGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/PatchAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + ProximityPlacementGroup resource = + manager + .proximityPlacementGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myProximityPlacementGroup", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProp1", "string")).apply(); + } + + @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; + } +} +``` + +### ResourceSkus_List + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceSkus List. */ +public final class ResourceSkusListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json + */ + /** + * Sample code: Lists all available Resource SKUs. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUs( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json + */ + /** + * Sample code: Lists all available Resource SKUs for the specified region. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUsForTheSpecifiedRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list("location eq 'westus'", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json + */ + /** + * Sample code: Lists all available Resource SKUs with Extended Location information. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUsWithExtendedLocationInformation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list(null, "true", Context.NONE); + } +} +``` + +### RestorePointCollections_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RestorePointCollections CreateOrUpdate. */ +public final class RestorePointCollectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateARestorePointCollectionForCrossRegionCopy.json + */ + /** + * Sample code: Create or update a restore point collection for cross region copy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARestorePointCollectionForCrossRegionCopy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .define("myRpc") + .withRegion("norwayeast") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("myTag1", "tagValue1")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateARestorePointCollection.json + */ + /** + * Sample code: Create or update a restore point collection. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .define("myRpc") + .withRegion("norwayeast") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("myTag1", "tagValue1")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .create(); + } + + @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; + } +} +``` + +### RestorePointCollections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections Delete. */ +public final class RestorePointCollectionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().delete("rgcompute", "aaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### RestorePointCollections_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections GetByResourceGroup. */ +public final class RestorePointCollectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionWithContainedRestorePoints.json + */ + /** + * Sample code: Get a restore point collection, including the restore points contained in the restore point + * collection. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "rpcName", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollection.json + */ + /** + * Sample code: Get a restore point collection (but not the restore points contained in the restore point + * collection). + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "myRpc", null, Context.NONE); + } +} +``` + +### RestorePointCollections_List + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections List. */ +public final class RestorePointCollectionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionsInASubscription.json + */ + /** + * Sample code: Gets the list of restore point collections in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void getsTheListOfRestorePointCollectionsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().list(Context.NONE); + } +} +``` + +### RestorePointCollections_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections ListByResourceGroup. */ +public final class RestorePointCollectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionsInAResourceGroup.json + */ + /** + * Sample code: Gets the list of restore point collections in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void getsTheListOfRestorePointCollectionsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### RestorePointCollections_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollection; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RestorePointCollections Update. */ +public final class RestorePointCollectionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + RestorePointCollection resource = + manager + .restorePointCollections() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key8536", "aaaaaaaaaaaaaaaaaaa")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Update_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + RestorePointCollection resource = + manager + .restorePointCollections() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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; + } +} +``` + +### RestorePoints_Create + +```java +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import java.util.Arrays; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CopyRestorePointBetweenRegions.json + */ + /** + * Sample code: Copy a restore point to a different region. + * + * @param manager Entry point to ComputeManager. + */ + public static void copyARestorePointToADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePoints() + .define("rpName") + .withExistingRestorePointCollection("myResourceGroup", "rpcName") + .withSourceRestorePoint( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateARestorePoint.json + */ + /** + * Sample code: Create a restore point. + * + * @param manager Entry point to ComputeManager. + */ + public static void createARestorePoint(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePoints() + .define("rpName") + .withExistingRestorePointCollection("myResourceGroup", "rpcName") + .withExcludeDisks( + Arrays + .asList( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"))) + .create(); + } +} +``` + +### RestorePoints_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePoints_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePoints_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().delete("rgcompute", "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePoints_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePoints_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", "a", Context.NONE); + } +} +``` + +### RestorePoints_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePoint.json + */ + /** + * Sample code: Get a restore point. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePoint(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().getWithResponse("myResourceGroup", "rpcName", "rpName", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointWithInstanceView.json + */ + /** + * Sample code: Get restore point with instance view. + * + * @param manager Entry point to ComputeManager. + */ + public static void getRestorePointWithInstanceView( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().getWithResponse("myResourceGroup", "rpcName", "rpName", null, Context.NONE); + } +} +``` + +### SharedGalleries_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleries Get. */ +public final class SharedGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleries().getWithResponse("myLocation", "galleryUniqueName", Context.NONE); + } +} +``` + +### SharedGalleries_List + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleries List. */ +public final class SharedGalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleries.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleries().list("myLocation", null, Context.NONE); + } +} +``` + +### SharedGalleryImageVersions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions Get. */ +public final class SharedGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImageVersions() + .getWithResponse( + "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} +``` + +### SharedGalleryImageVersions_List + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions List. */ +public final class SharedGalleryImageVersionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImageVersions.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImageVersions() + .list("myLocation", "galleryUniqueName", "myGalleryImageName", null, Context.NONE); + } +} +``` + +### SharedGalleryImages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages Get. */ +public final class SharedGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImages() + .getWithResponse("myLocation", "galleryUniqueName", "myGalleryImageName", Context.NONE); + } +} +``` + +### SharedGalleryImages_List + +```java +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages List. */ +public final class SharedGalleryImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImages.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleryImages().list("myLocation", "galleryUniqueName", null, Context.NONE); + } +} +``` + +### Snapshots_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOption; + +/** Samples for Snapshots CreateOrUpdate. */ +public final class SnapshotsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotFromAnExistingSnapshotInDifferentRegion.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription in a different + * region. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY_START) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from the same subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot1") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot1") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } +} +``` + +### Snapshots_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Snapshots Delete. */ +public final class SnapshotsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteASnapshot.json + */ + /** + * Sample code: Delete a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().delete("myResourceGroup", "mySnapshot", Context.NONE); + } +} +``` + +### Snapshots_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Snapshots GetByResourceGroup. */ +public final class SnapshotsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutASnapshot.json + */ + /** + * Sample code: Get information about a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE); + } +} +``` + +### Snapshots_GrantAccess + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for Snapshots GrantAccess. */ +public final class SnapshotsGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessSnapshot.json + */ + /** + * Sample code: Get a sas on a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void getASasOnASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .grantAccess( + "myResourceGroup", + "mySnapshot", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} +``` + +### Snapshots_List + +```java +import com.azure.core.util.Context; + +/** Samples for Snapshots List. */ +public final class SnapshotsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListSnapshotsInASubscription.json + */ + /** + * Sample code: List all snapshots in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllSnapshotsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().list(Context.NONE); + } +} +``` + +### Snapshots_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Snapshots ListByResourceGroup. */ +public final class SnapshotsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListSnapshotsInAResourceGroup.json + */ + /** + * Sample code: List all snapshots in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllSnapshotsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### Snapshots_RevokeAccess + +```java +import com.azure.core.util.Context; + +/** Samples for Snapshots RevokeAccess. */ +public final class SnapshotsRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessSnapshot.json + */ + /** + * Sample code: Revoke access to a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokeAccessToASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().revokeAccess("myResourceGroup", "mySnapshot", Context.NONE); + } +} +``` + +### Snapshots_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Snapshot; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Snapshots Update. */ +public final class SnapshotsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateASnapshotWithAcceleratedNetwork.json + */ + /** + * Sample code: Update a snapshot with accelerated networking. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASnapshotWithAcceleratedNetworking( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Snapshot resource = + manager + .snapshots() + .getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "UpdateSnapshots")) + .withDiskSizeGB(20) + .withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateASnapshot.json + */ + /** + * Sample code: Update a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Snapshot resource = + manager + .snapshots() + .getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "UpdateSnapshots")) + .withDiskSizeGB(20) + .apply(); + } + + @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; + } +} +``` + +### SshPublicKeys_Create + +```java +/** Samples for SshPublicKeys Create. */ +public final class SshPublicKeysCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnSshPublicKey.json + */ + /** + * Sample code: Create a new SSH public key resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createANewSSHPublicKeyResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sshPublicKeys() + .define("mySshPublicKeyName") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPublicKey("{ssh-rsa public key}") + .create(); + } +} +``` + +### SshPublicKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys Delete. */ +public final class SshPublicKeysDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().deleteWithResponse("rgcompute", "aaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### SshPublicKeys_GenerateKeyPair + +```java +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GenerateKeyPair. */ +public final class SshPublicKeysGenerateKeyPairSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GenerateSshKeyPair.json + */ + /** + * Sample code: Generate an SSH key pair. + * + * @param manager Entry point to ComputeManager. + */ + public static void generateAnSSHKeyPair(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().generateKeyPairWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} +``` + +### SshPublicKeys_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GetByResourceGroup. */ +public final class SshPublicKeysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetAnSshPublicKey.json + */ + /** + * Sample code: Get an ssh public key. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnSshPublicKey(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().getByResourceGroupWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} +``` + +### SshPublicKeys_List + +```java +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys List. */ +public final class SshPublicKeysListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListBySubscription_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListBySubscriptionMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().list(Context.NONE); + } +} +``` + +### SshPublicKeys_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys ListByResourceGroup. */ +public final class SshPublicKeysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListByResourceGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListByResourceGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().listByResourceGroup("rgcompute", Context.NONE); + } +} +``` + +### SshPublicKeys_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SshPublicKeys Update. */ +public final class SshPublicKeysUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Update_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + SshPublicKeyResource resource = + manager + .sshPublicKeys() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaa", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key2854", "a")).withPublicKey("{ssh-rsa public key}").apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Update_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + SshPublicKeyResource resource = + manager.sshPublicKeys().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaa", Context.NONE).getValue(); + resource.update().apply(); + } + + @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; + } +} +``` + +### Usage_List + +```java +import com.azure.core.util.Context; + +/** Samples for Usage List. */ +public final class UsageListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Usage_List_MinimumSet_Gen.json + */ + /** + * Sample code: Usage_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void usageListMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.usages().list("_--", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Usage_List_MaximumSet_Gen.json + */ + /** + * Sample code: Usage_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void usageListMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.usages().list("4_.", Context.NONE); + } +} +``` + +### VirtualMachineExtensionImages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages Get. */ +public final class VirtualMachineExtensionImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .getWithResponse( + "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .getWithResponse("aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", Context.NONE); + } +} +``` + +### VirtualMachineExtensionImages_ListTypes + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages ListTypes. */ +public final class VirtualMachineExtensionImagesListTypesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListTypesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listTypesWithResponse("aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListTypesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineExtensionImages().listTypesWithResponse("aaaa", "aa", Context.NONE); + } +} +``` + +### VirtualMachineExtensionImages_ListVersions + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages ListVersions. */ +public final class VirtualMachineExtensionImagesListVersionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListVersionsMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listVersionsWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaa", + 22, + "a", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListVersionsMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listVersionsWithResponse( + "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", null, null, null, Context.NONE); + } +} +``` + +### VirtualMachineExtensions_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.StatusLevelTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineExtensions CreateOrUpdate. */ +public final class VirtualMachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .define("aaaaaaaaaaaaaaaaaaaaaaaa") + .withRegion("westus") + .withExistingVirtualMachine("rgcompute", "aaaa") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineExtensions() + .define("aaaaaaaaaaaaa") + .withRegion("westus") + .withExistingVirtualMachine("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa") + .withTags(mapOf("key9183", "aa")) + .withForceUpdateTag("a") + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withInstanceView( + new VirtualMachineExtensionInstanceView() + .withName("aaaaaaaaaaaaaaaaa") + .withType("aaaaaaaaa") + .withTypeHandlerVersion("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSubstatuses( + Arrays + .asList( + new InstanceViewStatus() + .withCode("aaaaaaaaaaaaaaaaaaaaaaa") + .withLevel(StatusLevelTypes.INFO) + .withDisplayStatus("aaaaaa") + .withMessage("a") + .withTime(OffsetDateTime.parse("2021-11-30T12:58:26.522Z")))) + .withStatuses( + Arrays + .asList( + new InstanceViewStatus() + .withCode("aaaaaaaaaaaaaaaaaaaaaaa") + .withLevel(StatusLevelTypes.INFO) + .withDisplayStatus("aaaaaa") + .withMessage("a") + .withTime(OffsetDateTime.parse("2021-11-30T12:58:26.522Z"))))) + .withSuppressFailures(true) + .create(); + } + + @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; + } +} +``` + +### VirtualMachineExtensions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions Delete. */ +public final class VirtualMachineExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .delete("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineExtensions().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aa", Context.NONE); + } +} +``` + +### VirtualMachineExtensions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions Get. */ +public final class VirtualMachineExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .getWithResponse("rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", "aaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineExtensions_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions List. */ +public final class VirtualMachineExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .listWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .listWithResponse("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineExtensions_Update + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import java.io.IOException; + +/** Samples for VirtualMachineExtensions Update. */ +public final class VirtualMachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMExtension.json + */ + /** + * Sample code: Update VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVMExtension(com.azure.resourcemanager.compute.generated.ComputeManager manager) + throws IOException { + VirtualMachineExtension resource = + manager + .virtualMachineExtensions() + .getWithResponse("myResourceGroup", "myVM", "myVMExtension", null, Context.NONE) + .getValue(); + resource + .update() + .withPublisher("extPublisher") + .withType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"secretUrl\":\"https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e\",\"sourceVault\":{\"id\":\"/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName\"}}", + Object.class, + SerializerEncoding.JSON)) + .apply(); + } +} +``` + +### VirtualMachineImages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages Get. */ +public final class VirtualMachineImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .getWithResponse( + "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .getWithResponse( + "aaaaaa", + "aaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaa", + Context.NONE); + } +} +``` + +### VirtualMachineImages_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages List. */ +public final class VirtualMachineImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listWithResponse("aaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaa", "aaaaaa", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listWithResponse( + "aaaaaaaaaaaaaaa", + "aaaaaa", + "aaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaa", + 18, + "aa", + Context.NONE); + } +} +``` + +### VirtualMachineImages_ListOffers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListOffers. */ +public final class VirtualMachineImagesListOffersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListOffers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListOffers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListOffersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listOffersWithResponse("aaaaaaa", "aaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListOffers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListOffers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListOffersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listOffersWithResponse("aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineImages_ListPublishers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListPublishers. */ +public final class VirtualMachineImagesListPublishersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListPublishers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListPublishers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListPublishersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listPublishersWithResponse("aaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListPublishers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListPublishers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListPublishersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listPublishersWithResponse("aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineImages_ListSkus + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListSkus. */ +public final class VirtualMachineImagesListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listSkusWithResponse("aaaa", "aaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listSkusWithResponse("aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineImagesEdgeZone_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone Get. */ +public final class VirtualMachineImagesEdgeZoneGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .getWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .getWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaa", + "aa", + Context.NONE); + } +} +``` + +### VirtualMachineImagesEdgeZone_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone List. */ +public final class VirtualMachineImagesEdgeZoneListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listWithResponse( + "aaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaa", + 12, + "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaa", + "aaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + null, + null, + null, + Context.NONE); + } +} +``` + +### VirtualMachineImagesEdgeZone_ListOffers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListOffers. */ +public final class VirtualMachineImagesEdgeZoneListOffersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListOffersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listOffersWithResponse("aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListOffersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listOffersWithResponse( + "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineImagesEdgeZone_ListPublishers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListPublishers. */ +public final class VirtualMachineImagesEdgeZoneListPublishersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListPublishersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listPublishersWithResponse("aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListPublishersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listPublishersWithResponse("aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineImagesEdgeZone_ListSkus + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListSkus. */ +public final class VirtualMachineImagesEdgeZoneListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listSkusWithResponse("aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listSkusWithResponse( + "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_CreateOrUpdate + +```java +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineRunCommands CreateOrUpdate. */ +public final class VirtualMachineRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/CreateOrUpdateRunCommand.json + */ + /** + * Sample code: Create or update a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineRunCommands() + .define("myRunCommand") + .withRegion("West US") + .withExistingVirtualMachine("myResourceGroup", "myVM") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600) + .create(); + } +} +``` + +### VirtualMachineRunCommands_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Delete. */ +public final class VirtualMachineRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/DeleteRunCommand.json + */ + /** + * Sample code: Delete a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().delete("myResourceGroup", "myVM", "myRunCommand", Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Get. */ +public final class VirtualMachineRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommandGet.json + */ + /** + * Sample code: VirtualMachineRunCommandGet. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommandGet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().getWithResponse("SoutheastAsia", "RunPowerShellScript", Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_GetByVirtualMachine + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands GetByVirtualMachine. */ +public final class VirtualMachineRunCommandsGetByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/GetRunCommand.json + */ + /** + * Sample code: Get a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineRunCommands() + .getByVirtualMachineWithResponse("myResourceGroup", "myVM", "myRunCommand", null, Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands List. */ +public final class VirtualMachineRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommandList.json + */ + /** + * Sample code: VirtualMachineRunCommandList. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommandList( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().list("SoutheastAsia", Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_ListByVirtualMachine + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands ListByVirtualMachine. */ +public final class VirtualMachineRunCommandsListByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/ListRunCommandsInVM.json + */ + /** + * Sample code: List run commands in a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRunCommandsInAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().listByVirtualMachine("myResourceGroup", "myVM", null, Context.NONE); + } +} +``` + +### VirtualMachineRunCommands_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommand; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; + +/** Samples for VirtualMachineRunCommands Update. */ +public final class VirtualMachineRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/UpdateRunCommand.json + */ + /** + * Sample code: Update a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineRunCommand resource = + manager + .virtualMachineRunCommands() + .getByVirtualMachineWithResponse("myResourceGroup", "myVM", "myRunCommand", null, Context.NONE) + .getValue(); + resource + .update() + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")) + .apply(); + } +} +``` + +### VirtualMachineScaleSetExtensions_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetExtensions CreateOrUpdate. */ +public final class VirtualMachineScaleSetExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSetExtensions() + .define("aaaaaaaaaaaaaaaaaaaaa") + .withExistingVirtualMachineScaleSet("rgcompute", "aaaaaaa") + .withName("{extension-name}") + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .define("aaaaaaaaaaa") + .withExistingVirtualMachineScaleSet("rgcompute", "aaaaaaaaaaa") + .create(); + } +} +``` + +### VirtualMachineScaleSetExtensions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions Delete. */ +public final class VirtualMachineScaleSetExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().delete("rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetExtensions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions Get. */ +public final class VirtualMachineScaleSetExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetExtensions_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions List. */ +public final class VirtualMachineScaleSetExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().list("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().list("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetExtensions_Update + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtension; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetExtensions Update. */ +public final class VirtualMachineScaleSetExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSetExtension resource = + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineScaleSetExtension resource = + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### VirtualMachineScaleSetRollingUpgrades_Cancel + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades Cancel. */ +public final class VirtualMachineScaleSetRollingUpgradesCancelSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesCancelMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().cancel("rgcompute", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesCancelMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().cancel("rgcompute", "aaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetRollingUpgrades_GetLatest + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades GetLatest. */ +public final class VirtualMachineScaleSetRollingUpgradesGetLatestSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesGetLatestMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .getLatestWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesGetLatestMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .getLatestWithResponse("rgcompute", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetRollingUpgrades_StartExtensionUpgrade + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades StartExtensionUpgrade. */ +public final class VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VMScaleSetExtensionRollingUpgrade.json + */ + /** + * Sample code: Start an extension rolling upgrade. + * + * @param manager Entry point to ComputeManager. + */ + public static void startAnExtensionRollingUpgrade( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .startExtensionUpgrade("myResourceGroup", "{vmss-name}", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades StartOSUpgrade. */ +public final class VirtualMachineScaleSetRollingUpgradesStartOSUpgradeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesStartOSUpgradeMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().startOSUpgrade("rgcompute", "aaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesStartOSUpgradeMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().startOSUpgrade("rgcompute", "aaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMExtensions_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void createVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSetVMExtensions() + .define("myVMExtension") + .withExistingVirtualMachine("myResourceGroup", "myvmScaleSet", "0") + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .create(); + } +} +``` + +### VirtualMachineScaleSetVMExtensions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Delete. */ +public final class VirtualMachineScaleSetVMExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DeleteVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .delete("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMExtensions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Get. */ +public final class VirtualMachineScaleSetVMExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMExtensions_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions List. */ +public final class VirtualMachineScaleSetVMExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: List extensions in Vmss instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void listExtensionsInVmssInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .listWithResponse("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMExtensions_Update + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtension; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions Update. */ +public final class VirtualMachineScaleSetVMExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSetVMExtension resource = + manager + .virtualMachineScaleSetVMExtensions() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", null, Context.NONE) + .getValue(); + resource + .update() + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .apply(); + } +} +``` + +### VirtualMachineScaleSetVMRunCommands_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMRunCommands CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/CreateOrUpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void createVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .createOrUpdate( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandInner() + .withLocation("West US") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMRunCommands_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Delete. */ +public final class VirtualMachineScaleSetVMRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/DeleteVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .delete("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMRunCommands_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Get. */ +public final class VirtualMachineScaleSetVMRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/GetVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM run commands. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineScaleSetVMRunCommands( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMRunCommands_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands List. */ +public final class VirtualMachineScaleSetVMRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/ListVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: List run commands in Vmss instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRunCommandsInVmssInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMRunCommands().list("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMRunCommands_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; + +/** Samples for VirtualMachineScaleSetVMRunCommands Update. */ +public final class VirtualMachineScaleSetVMRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/UpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .update( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandUpdate() + .withSource( + new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Deallocate + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Deallocate. */ +public final class VirtualMachineScaleSetVMsDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Delete. */ +public final class VirtualMachineScaleSetVMsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachineScaleSetVM.json + */ + /** + * Sample code: Force Delete a virtual machine from a VM scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVirtualMachineFromAVMScaleSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().delete("myResourceGroup", "myvmScaleSet", "0", true, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Get. */ +public final class VirtualMachineScaleSetVMsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMWithVMSizeProperties.json + */ + /** + * Sample code: Get VM scale set VM with VMSizeProperties. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVMScaleSetVMWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().getWithResponse("myResourceGroup", "{vmss-name}", "0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMWithUserData.json + */ + /** + * Sample code: Get VM scale set VM with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVMScaleSetVMWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().getWithResponse("myResourceGroup", "{vmss-name}", "0", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_GetInstanceView + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs GetInstanceView. */ +public final class VirtualMachineScaleSetVMsGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine from a VM scale set placed on a dedicated host group through + * automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .getInstanceViewWithResponse("myResourceGroup", "myVirtualMachineScaleSet", "0", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs List. */ +public final class VirtualMachineScaleSetVMsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .list("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .list( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaa", + Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_PerformMaintenance + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs PerformMaintenance. */ +public final class VirtualMachineScaleSetVMsPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().performMaintenance("rgcompute", "aaaaaaaaaa", "aaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .performMaintenance("rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_PowerOff + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs PowerOff. */ +public final class VirtualMachineScaleSetVMsPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().powerOff("rgcompute", "aaaaaa", "aaaaaaaaa", true, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .powerOff("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Redeploy + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Redeploy. */ +public final class VirtualMachineScaleSetVMsRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .redeploy("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .redeploy("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Reimage + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMReimageParameters; + +/** Samples for VirtualMachineScaleSetVMs Reimage. */ +public final class VirtualMachineScaleSetVMsReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimage( + "rgcompute", + "aaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMReimageParameters().withTempDisk(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().reimage("rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_ReimageAll + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs ReimageAll. */ +public final class VirtualMachineScaleSetVMsReimageAllSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Restart. */ +public final class VirtualMachineScaleSetVMsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().restart("rgcompute", "aaaaaaaaaaaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().restart("rgcompute", "aa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_RetrieveBootDiagnosticsData + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs RetrieveBootDiagnosticsData. */ +public final class VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "myvmScaleSet", "0", 60, Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_RunCommand + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMs RunCommand. */ +public final class VirtualMachineScaleSetVMsRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VMScaleSetRunCommand.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_RunCommand. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .runCommand( + "myResourceGroup", + "myVirtualMachineScaleSet", + "0", + new RunCommandInput() + .withCommandId("RunPowerShellScript") + .withScript(Arrays.asList("Write-Host Hello World!")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_SimulateEviction + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs SimulateEviction. */ +public final class VirtualMachineScaleSetVMsSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SimulateEvictionOfVmssVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void simulateEvictionAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .simulateEvictionWithResponse("ResourceGroup", "VmScaleSetName", "InstanceId", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Start + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Start. */ +public final class VirtualMachineScaleSetVMsStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .start("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().start("rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSetVMs_Update + +```java +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AdditionalUnattendContent; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.ComponentNames; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDetachOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSettings; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.IpVersions; +import com.azure.resourcemanager.compute.generated.models.KeyVaultKeyReference; +import com.azure.resourcemanager.compute.generated.models.KeyVaultSecretReference; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PassNames; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ProtocolTypes; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSku; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.compute.generated.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SettingNames; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressDnsSettingsConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import com.azure.resourcemanager.compute.generated.models.WinRMConfiguration; +import com.azure.resourcemanager.compute.generated.models.WinRMListener; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineScaleSetVMs Update. */ +public final class VirtualMachineScaleSetVMsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .update( + "rgcompute", + "aaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInner().withLocation("westus"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .update( + "rgcompute", + "aaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInner() + .withLocation("westus") + .withTags(mapOf()) + .withPlan( + new Plan() + .withName("aaaaaaaaaa") + .withPublisher("aaaaaaaaaaaaaaaaaaaaaa") + .withProduct("aaaaaaaaaaaaaaaaaaaa") + .withPromotionCode("aaaaaaaaaaaaaaaaaaaa")) + .withHardwareProfile( + new HardwareProfile() + .withVmSize(VirtualMachineSizeTypes.BASIC_A0) + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(9).withVCpusPerCore(12))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId("a") + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2012-R2-Datacenter") + .withVersion("4.127.20180315") + .withSharedGalleryImageId("aaaaaaaaaaaaaaaaaaaa")) + .withOsDisk( + new OSDisk() + .withOsType(OperatingSystemTypes.WINDOWS) + .withEncryptionSettings( + new DiskEncryptionSettings() + .withDiskEncryptionKey( + new KeyVaultSecretReference() + .withSecretUrl("aaaaaaaa") + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withKeyEncryptionKey( + new KeyVaultKeyReference() + .withKeyUrl("aaaaaaaaaaaaaa") + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withEnabled(true)) + .withName("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc") + .withVhd( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(127) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(1) + .withName("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d") + .withVhd( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(128) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withToBeDetached(true) + .withDetachOption(DiskDetachOptionTypes.FORCE_DETACH) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)))) + .withAdditionalCapabilities( + new AdditionalCapabilities().withUltraSsdEnabled(true).withHibernationEnabled(true)) + .withOsProfile( + new OSProfile() + .withComputerName("test000000") + .withAdminUsername("Foo12") + .withAdminPassword("aaaaaaaaaaaaaaaa") + .withCustomData("aaaa") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("aaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withAdditionalUnattendContent( + Arrays + .asList( + new AdditionalUnattendContent() + .withPassName(PassNames.OOBE_SYSTEM) + .withComponentName(ComponentNames.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("aaaaaaaaaaaaaaaaaaaa"))) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)) + .withWinRM( + new WinRMConfiguration() + .withListeners( + Arrays + .asList( + new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("aaaaaaaaaaaaaaaaaaaaaa"))))) + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList(new SshPublicKey().withPath("aaa").withKeyData("aaaaaa")))) + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT))) + .withSecrets(Arrays.asList()) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceConfiguration() + .withName("aaaaaaaaaaa") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withEnableIpForwarding(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withDnsSettings( + new VirtualMachineNetworkInterfaceDnsSettingsConfiguration() + .withDnsServers(Arrays.asList("aaaaaa"))) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceIpConfiguration() + .withName("aa") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachinePublicIpAddressConfiguration() + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL)) + .withIdleTimeoutInMinutes(2) + .withDeleteOption(DeleteOptions.DELETE) + .withDnsSettings( + new VirtualMachinePublicIpAddressDnsSettingsConfiguration() + .withDomainNameLabel( + "aaaaaaaaaaaaaaaaaaaaaaaaa")) + .withIpTags( + Arrays + .asList( + new VirtualMachineIpTag() + .withIpTagType( + "aaaaaaaaaaaaaaaaaaaaaaaaa") + .withTag("aaaaaaaaaaaaaaaaaaaa"))) + .withPublicIpPrefix( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPublicIpAddressVersion(IpVersions.IPV4) + .withPublicIpAllocationMethod( + PublicIpAllocationMethod.DYNAMIC)) + .withPrivateIpAddressVersion(IpVersions.IPV4) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withDscpConfiguration( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withNetworkProfileConfiguration( + new VirtualMachineScaleSetVMNetworkProfileConfiguration() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withId("aaaaaaaa") + .withName("vmsstestnetconfig5415") + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withDnsSettings( + new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList())) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withId("aaaaaaaaa") + .withName("vmsstestnetconfig9693") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("aaaaaaaaaaaaaaaaaa") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL)) + .withIdleTimeoutInMinutes(18) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("aaaaaaaaaaaaaaaaaa")) + .withIpTags( + Arrays + .asList( + new VirtualMachineScaleSetIpTag() + .withIpTagType("aaaaaaa") + .withTag( + "aaaaaaaaaaaaaaaaaaaaaaaaaaa"))) + .withPublicIpPrefix( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics().withEnabled(true).withStorageUri("aaaaaaaaaaaaa"))) + .withAvailabilitySet( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withLicenseType("aaaaaaaaaa") + .withProtectionPolicy( + new VirtualMachineScaleSetVMProtectionPolicy() + .withProtectFromScaleIn(true) + .withProtectFromScaleSetActions(true)) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ=="), + Context.NONE); + } + + @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; + } +} +``` + +### VirtualMachineScaleSets_ConvertToSinglePlacementGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; + +/** Samples for VirtualMachineScaleSets ConvertToSinglePlacementGroup. */ +public final class VirtualMachineScaleSetsConvertToSinglePlacementGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsConvertToSinglePlacementGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .convertToSinglePlacementGroupWithResponse( + "rgcompute", "aaaaaaaaaaaaa", new VMScaleSetConvertToSinglePlacementGroupInput(), Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsConvertToSinglePlacementGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .convertToSinglePlacementGroupWithResponse( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VMScaleSetConvertToSinglePlacementGroupInput() + .withActivePlacementGroupId("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_CreateOrUpdate + +```java +import com.azure.core.management.SubResource; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.UpgradeMode; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetScaleInRules; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProfile; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets CreateOrUpdate. */ +public final class VirtualMachineScaleSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ + /** + * Sample code: Create a scale set with empty data disks on each vm. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEmptyDataDisksOnEachVm( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D2_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithUserData.json + */ + /** + * Sample code: Create a scale set with userData. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==")) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ + /** + * Sample code: Create a scale set with Fpga Network Interfaces. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithFpgaNetworkInterfaces( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true), + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{fpgaNic-Name}") + .withPrimary(false) + .withEnableAcceleratedNetworking(false) + .withEnableFpga(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{fpgaNic-Name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}")) + .withPrimary(true) + .withPrivateIpAddressVersion(IpVersion.IPV4))) + .withEnableIpForwarding(false))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromACustomImage.json + */ + /** + * Sample code: Create a scale set from a custom image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromACustomImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEphemeralOsDisksUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithScaleInPolicy.json + */ + /** + * Sample code: Create a scale set with scaleInPolicy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithScaleInPolicy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .withScaleInPolicy( + new ScaleInPolicy() + .withRules(Arrays.asList(VirtualMachineScaleSetScaleInRules.OLDEST_VM)) + .withForceDeletion(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithEncryptionAtHost.json + */ + /** + * Sample code: Create a scale set with Host Encryption using encryptionAtHost property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithProtectedSettingsFromKeyVault.json + */ + /** + * Sample code: Create a VMSS with an extension with protectedSettingsFromKeyVault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMSSWithAnExtensionWithProtectedSettingsFromKeyVault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettingsFromKeyVault( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"secretUrl\":\"https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e\",\"sourceVault\":{\"id\":\"/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName\"}}", + Object.class, + SerializerEncoding.JSON)))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAnAzureLoadBalancer.json + */ + /** + * Sample code: Create a scale set with an azure load balancer. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAnAzureLoadBalancer( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("{vmss-name}") + .withPublicIpAddressVersion(IpVersion.IPV4)) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with managed boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithManagedBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a scale set with a marketplace image plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAMarketplaceImagePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithDiffOsDisk.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEphemeralOsDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithVMsInDifferentZones.json + */ + /** + * Sample code: Create a scale set with virtual machines in different zones. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithVirtualMachinesInDifferentZones( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("centralus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_A1_v2").withTier("Standard").withCapacity(2L)) + .withZones(Arrays.asList("1", "3")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithCapacityReservation.json + */ + /** + * Sample code: Create or update a scale set with capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAScaleSetWithCapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}")))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSecurityTypeConfidentialVM.json + */ + /** + * Sample code: Create a scale set with SecurityType as ConfidentialVM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSecurityTypeAsConfidentialVM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DC2as_v5").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType( + SecurityEncryptionTypes.VMGUEST_STATE_ONLY))))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSshAuthentication.json + */ + /** + * Sample code: Create a scale set with ssh authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSshAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAnAzureApplicationGateway.json + */ + /** + * Sample code: Create a scale set with an azure application gateway. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAnAzureApplicationGateway( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image scale set from an unmanaged generalized os image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a scale set with extension time budget. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithExtensionTimeBudget( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)))) + .withExtensionsTimeBudget("PT1H20M"))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithApplicationProfile.json + */ + /** + * Sample code: Create a scale set with Application Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithApplicationProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScalesetWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a scale set with DiskEncryptionSet resource in os disk and data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithPremiumStorage.json + */ + /** + * Sample code: Create a scale set with premium storage. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithPremiumStorage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithVMSizeProperties.json + */ + /** + * Sample code: Create a scale set with vm size properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithVmSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==") + .withHardwareProfile( + new VirtualMachineScaleSetHardwareProfile() + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(1).withVCpusPerCore(1)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ + /** + * Sample code: Create a scale set with terminate scheduled events enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithTerminateScheduledEventsEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT5M").withEnable(true)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithExtensionsSuppressFailuresEnabled.json + */ + /** + * Sample code: Create a VMSS with an extension that has suppressFailures enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMSSWithAnExtensionThatHasSuppressFailuresEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ + /** + * Sample code: Create a platform-image scale set with unmanaged os disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAPlatformImageScaleSetWithUnmanagedOsDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withVhdContainers( + Arrays + .asList( + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithUefiSettings.json + */ + /** + * Sample code: Create a scale set with Uefi Settings of secureBoot and vTPM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D2s_v3").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithPasswordAuthentication.json + */ + /** + * Sample code: Create a scale set with password authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithPasswordAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAutomaticRepairs.json + */ + /** + * Sample code: Create a scale set with automatic repairs enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAutomaticRepairsEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withAutomaticRepairsPolicy(new AutomaticRepairsPolicy().withEnabled(true).withGracePeriod("PT10M")) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSpotRestorePolicy.json + */ + /** + * Sample code: Create a scale set with spot restore policy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSpotRestorePolicy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_A8m_v2").withTier("Standard").withCapacity(2L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withPriority(VirtualMachinePriorityTypes.SPOT) + .withEvictionPolicy(VirtualMachineEvictionPolicyTypes.DEALLOCATE) + .withBillingProfile(new BillingProfile().withMaxPrice(-1.0))) + .withOverprovision(true) + .withSpotRestorePolicy(new SpotRestorePolicy().withEnabled(true).withRestoreTimeout("PT1H")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a scale set from a generalized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromAGeneralizedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net")))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a scale set from a specialized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromASpecializedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } +} +``` + +### VirtualMachineScaleSets_Deallocate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Deallocate. */ +public final class VirtualMachineScaleSetsDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deallocate( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets Delete. */ +public final class VirtualMachineScaleSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachineScaleSets.json + */ + /** + * Sample code: Force Delete a VM scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVMScaleSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().delete("myResourceGroup", "myvmScaleSet", true, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_DeleteInstances + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets DeleteInstances. */ +public final class VirtualMachineScaleSetsDeleteInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeleteInstancesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deleteInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + true, + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeleteInstancesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deleteInstances( + "rgcompute", + "aaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + null, + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ForceRecoveryServiceFabricPlatformUpdateDomainWalk. */ +public final class VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + "rgcompute", "aaaaaaaaaaaa", 9, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + "rgcompute", "aaaaaaaaaaaaaaaa", 30, null, null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetByResourceGroup. */ +public final class VirtualMachineScaleSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine scale set placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSet.json + */ + /** + * Sample code: Get a virtual machine scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetWithUserData.json + */ + /** + * Sample code: Get a virtual machine scale set with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSetWithUserData( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_GetInstanceView + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetInstanceView. */ +public final class VirtualMachineScaleSetsGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetInstanceViewMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getInstanceViewWithResponse("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetInstanceViewMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getInstanceViewWithResponse("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_GetOSUpgradeHistory + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetOSUpgradeHistory. */ +public final class VirtualMachineScaleSetsGetOSUpgradeHistorySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetOSUpgradeHistoryMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getOSUpgradeHistory("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetOSUpgradeHistoryMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getOSUpgradeHistory("rgcompute", "aaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets List. */ +public final class VirtualMachineScaleSetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().list(Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListByLocation. */ +public final class VirtualMachineScaleSetsListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachineScaleSetsInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the VM scale sets under the specified subscription for the specified location. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllTheVMScaleSetsUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByLocation("eastus", Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListByResourceGroup. */ +public final class VirtualMachineScaleSetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByResourceGroup("rgcompute", Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_ListSkus + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListSkus. */ +public final class VirtualMachineScaleSetsListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listSkus("rgcompute", "aaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listSkus("rgcompute", "aaaaaa", Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_PerformMaintenance + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets PerformMaintenance. */ +public final class VirtualMachineScaleSetsPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .performMaintenance( + "rgcompute", + "aaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().performMaintenance("rgcompute", "aa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_PowerOff + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets PowerOff. */ +public final class VirtualMachineScaleSetsPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().powerOff("rgcompute", "a", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .powerOff( + "rgcompute", + "aaaaaaaaaaaaaaaaaa", + true, + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Redeploy + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Redeploy. */ +public final class VirtualMachineScaleSetsRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().redeploy("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .redeploy( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Reimage + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Reimage. */ +public final class VirtualMachineScaleSetsReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Reimage_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Reimage_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().reimage("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Reimage_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Reimage_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .reimage( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetReimageParameters() + .withTempDisk(true) + .withInstanceIds(Arrays.asList("aaaaaaaaaa")), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_ReimageAll + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets ReimageAll. */ +public final class VirtualMachineScaleSetsReimageAllSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .reimageAll( + "rgcompute", + "aaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Restart + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Restart. */ +public final class VirtualMachineScaleSetsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .restart( + "rgcompute", + "aaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().restart("rgcompute", "aaaa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_SetOrchestrationServiceState + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceNames; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateAction; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; + +/** Samples for VirtualMachineScaleSets SetOrchestrationServiceState. */ +public final class VirtualMachineScaleSetsSetOrchestrationServiceStateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsSetOrchestrationServiceStateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .setOrchestrationServiceState( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new OrchestrationServiceStateInput() + .withServiceName(OrchestrationServiceNames.AUTOMATIC_REPAIRS) + .withAction(OrchestrationServiceStateAction.RESUME), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsSetOrchestrationServiceStateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .setOrchestrationServiceState( + "rgcompute", + "aaaaaaaaaaaaaaaa", + new OrchestrationServiceStateInput() + .withServiceName(OrchestrationServiceNames.AUTOMATIC_REPAIRS) + .withAction(OrchestrationServiceStateAction.RESUME), + Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Start + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Start. */ +public final class VirtualMachineScaleSetsStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .start( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().start("rgcompute", "aaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} +``` + +### VirtualMachineScaleSets_Update + +```java +import com.azure.core.management.SubResource; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AdditionalUnattendContent; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.AutomaticOSUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.ComponentNames; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.PassNames; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ProtocolTypes; +import com.azure.resourcemanager.compute.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SettingNames; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.UpgradeMode; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VaultCertificate; +import com.azure.resourcemanager.compute.generated.models.VaultSecretGroup; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSet; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetScaleInRules; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateOSDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateOSProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdatePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateStorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateVMProfile; +import com.azure.resourcemanager.compute.generated.models.WinRMConfiguration; +import com.azure.resourcemanager.compute.generated.models.WinRMListener; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineScaleSets Update. */ +public final class VirtualMachineScaleSetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineScaleSet resource = + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSet resource = + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key246", "aaaaaaaaaaaaaaaaaaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm") + .withPromotionCode("aaaaaaaaaa")) + .withIdentity( + new VirtualMachineScaleSetIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("key3951", new VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue()))) + .withUpgradePolicy( + new UpgradePolicy() + .withMode(UpgradeMode.MANUAL) + .withRollingUpgradePolicy( + new RollingUpgradePolicy() + .withMaxBatchInstancePercent(49) + .withMaxUnhealthyInstancePercent(81) + .withMaxUnhealthyUpgradedInstancePercent(98) + .withPauseTimeBetweenBatches("aaaaaaaaaaaaaaa") + .withEnableCrossZoneUpgrade(true) + .withPrioritizeUnhealthyInstances(true)) + .withAutomaticOSUpgradePolicy( + new AutomaticOSUpgradePolicy() + .withEnableAutomaticOSUpgrade(true) + .withDisableAutomaticRollback(true))) + .withAutomaticRepairsPolicy(new AutomaticRepairsPolicy().withEnabled(true).withGracePeriod("PT30M")) + .withVirtualMachineProfile( + new VirtualMachineScaleSetUpdateVMProfile() + .withOsProfile( + new VirtualMachineScaleSetUpdateOSProfile() + .withCustomData("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("aaaaaaaaaaaaaaaa") + .withAdditionalUnattendContent( + Arrays + .asList( + new AdditionalUnattendContent() + .withPassName(PassNames.OOBE_SYSTEM) + .withComponentName(ComponentNames.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("aaaaaaaaaaaaaaaaaaaa"))) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_OS) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)) + .withWinRM( + new WinRMConfiguration() + .withListeners( + Arrays + .asList( + new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("aaaaaaaaaaaaaaaaaaaaaa"))))) + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))) + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT))) + .withSecrets( + Arrays + .asList( + new VaultSecretGroup() + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withVaultCertificates( + Arrays + .asList( + new VaultCertificate() + .withCertificateUrl("aaaaaaa") + .withCertificateStore("aaaaaaaaaaaaaaaaaaaaaaaaa")))))) + .withStorageProfile( + new VirtualMachineScaleSetUpdateStorageProfile() + .withImageReference( + new ImageReference() + .withId("aaaaaaaaaaaaaaaaaaa") + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest") + .withSharedGalleryImageId("aaaaaa")) + .withOsDisk( + new VirtualMachineScaleSetUpdateOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withWriteAcceleratorEnabled(true) + .withDiskSizeGB(6) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withVhdContainers(Arrays.asList("aa")) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa")))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withLun(26) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withDiskIopsReadWrite(28L) + .withDiskMBpsReadWrite(15L)))) + .withNetworkProfile( + new VirtualMachineScaleSetUpdateNetworkProfile() + .withHealthProbe( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123")) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetUpdateNetworkConfiguration() + .withId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withName("aaaaaaaa") + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withDnsSettings( + new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList())) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetUpdateIpConfiguration() + .withId("aaaaaaaaaaaaaaaa") + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetUpdatePublicIpAddressConfiguration() + .withName("a") + .withIdleTimeoutInMinutes(3) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("aaaaaaaaaaaaaaaaaa")) + .withDeleteOption(DeleteOptions.DELETE)) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true))) + .withExtensionsTimeBudget("PT1H20M")) + .withLicenseType("aaaaaaaaaaaa") + .withBillingProfile(new BillingProfile().withMaxPrice(-1.0)) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT10M").withEnable(true))) + .withUserData("aaaaaaaaaaaaa")) + .withOverprovision(true) + .withDoNotRunExtensionsOnOverprovisionedVMs(true) + .withSinglePlacementGroup(true) + .withAdditionalCapabilities( + new AdditionalCapabilities().withUltraSsdEnabled(true).withHibernationEnabled(true)) + .withScaleInPolicy( + new ScaleInPolicy() + .withRules(Arrays.asList(VirtualMachineScaleSetScaleInRules.OLDEST_VM)) + .withForceDeletion(true)) + .withProximityPlacementGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .apply(); + } + + @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; + } +} +``` + +### VirtualMachineScaleSets_UpdateInstances + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets UpdateInstances. */ +public final class VirtualMachineScaleSetsUpdateInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateInstancesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .updateInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateInstancesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .updateInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} +``` + +### VirtualMachineSizes_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineSizes List. */ +public final class VirtualMachineSizesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineSizes_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineSizes_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineSizesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineSizes().list("._..", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineSizes_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineSizes_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineSizesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineSizes().list("-e", Context.NONE); + } +} +``` + +### VirtualMachines_AssessPatches + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines AssessPatches. */ +public final class VirtualMachinesAssessPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineAssessPatches.json + */ + /** + * Sample code: Assess patch state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void assessPatchStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().assessPatches("myResourceGroupName", "myVMName", Context.NONE); + } +} +``` + +### VirtualMachines_Capture + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; + +/** Samples for VirtualMachines Capture. */ +public final class VirtualMachinesCaptureSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Capture_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Capture_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesCaptureMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .capture( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineCaptureParameters() + .withVhdPrefix("aaaaaaaaa") + .withDestinationContainerName("aaaaaaa") + .withOverwriteVhds(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Capture_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Capture_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesCaptureMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .capture( + "rgcompute", + "aaaaaaaaaaaaa", + new VirtualMachineCaptureParameters() + .withVhdPrefix("aaaaaaaaa") + .withDestinationContainerName("aaaaaaa") + .withOverwriteVhds(true), + Context.NONE); + } +} +``` + +### VirtualMachines_ConvertToManagedDisks + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ConvertToManagedDisks. */ +public final class VirtualMachinesConvertToManagedDisksSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesConvertToManagedDisksMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().convertToManagedDisks("rgcompute", "aaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesConvertToManagedDisksMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().convertToManagedDisks("rgcompute", "aaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachines_CreateOrUpdate + +```java +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSku; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.compute.generated.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.util.Arrays; + +/** Samples for VirtualMachines CreateOrUpdate. */ +public final class VirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromASharedGalleryImage.json + */ + /** + * Sample code: Create a VM from a shared gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMFromASharedGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withSharedGalleryImageId( + "/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithVMSizeProperties.json + */ + /** + * Sample code: Create a VM with VM Size Properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile() + .withVmSize(VirtualMachineSizeTypes.STANDARD_D4_V3) + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(1).withVCpusPerCore(1))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("U29tZSBDdXN0b20gRGF0YQ==") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ + /** + * Sample code: Create a platform-image vm with unmanaged os and data disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAPlatformImageVmWithUnmanagedOsAndDataDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE)) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Linux vm with a patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(LinuxPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Cache disk using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a vm with a marketplace image plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithAMarketplaceImagePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByOS.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByOS. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOS( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_OS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Windows vm with patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(WindowsPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Windows vm with a patch setting assessmentMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithPremiumStorage.json + */ + /** + * Sample code: Create a vm with premium storage. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithPremiumStorage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithCapacityReservation.json + */ + /** + * Sample code: Create or update a VM with capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAVMWithCapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting assessmentMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings().withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByPlatform and enableHotpatching set + * to true. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withEnableHotpatching(true)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a vm with an extensions time budget. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithAnExtensionsTimeBudget( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionsTimeBudget("PT30M") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image vm from an unmanaged generalized os image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createACustomImageVmFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withOsDisk( + new OSDisk() + .withOsType(OperatingSystemTypes.WINDOWS) + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithEncryptionAtHost.json + */ + /** + * Sample code: Create a vm with Host Encryption using encryptionAtHost property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmInAnAvailabilitySet.json + */ + /** + * Sample code: Create a vm in an availability set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmInAnAvailabilitySet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withAvailabilitySet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithEmptyDataDisks.json + */ + /** + * Sample code: Create a vm with empty data disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEmptyDataDisks(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSecurityTypeConfidentialVM.json + */ + /** + * Sample code: Create a VM with securityType ConfidentialVM with Platform Managed Keys. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithSecurityTypeConfidentialVMWithPlatformManagedKeys( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile().withVmSize(VirtualMachineSizeTypes.fromString("Standard_DC2as_v5"))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType( + SecurityEncryptionTypes.DISK_WITH_VMGUEST_STATE))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithNetworkInterfaceConfiguration.json + */ + /** + * Sample code: Create a VM with network interface configuration. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithNetworkInterfaceConfiguration( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceConfiguration() + .withName("{nic-config-name}") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceIpConfiguration() + .withName("{ip-config-name}") + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachinePublicIpAddressConfiguration() + .withName("{publicIP-config-name}") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.GLOBAL)) + .withDeleteOption(DeleteOptions.DETACH) + .withPublicIpAllocationMethod( + PublicIpAllocationMethod.STATIC))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromACustomImage.json + */ + /** + * Sample code: Create a vm from a custom image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromACustomImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithHibernationEnabled.json + */ + /** + * Sample code: Create a VM with HibernationEnabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithHibernationEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("eastus2euap") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2019-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withAdditionalCapabilities(new AdditionalCapabilities().withHibernationEnabled(true)) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithUefiSettings.json + */ + /** + * Sample code: Create a VM with Uefi Settings of secureBoot and vTPM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithApplicationProfile.json + */ + /** + * Sample code: Create a vm with Application Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithApplicationProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1")))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a vm from a specialized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromASpecializedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithPasswordAuthentication.json + */ + /** + * Sample code: Create a vm with password authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithPasswordAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain.json + */ + /** + * Sample code: Create a vm in a Virtual Machine Scale Set with customer assigned platformFaultDomain. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withVirtualMachineScaleSet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}")) + .withPlatformFaultDomain(1) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithScheduledEventsProfile.json + */ + /** + * Sample code: Create a vm with Scheduled Events Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithScheduledEventsProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT10M").withEnable(true))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithBootDiagnostics.json + */ + /** + * Sample code: Create a vm with boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSshAuthentication.json + */ + /** + * Sample code: Create a vm with ssh authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithSshAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromACommunityGalleryImage.json + */ + /** + * Sample code: Create a VM from a community gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMFromACommunityGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withCommunityGalleryImageId( + "/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Resource disk using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings(new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithUserData.json + */ + /** + * Sample code: Create a VM with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a vm from a generalized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromAGeneralizedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfManual.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of Manual. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfManual( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings(new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.MANUAL)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSecurityTypeConfidentialVMWithCustomerManagedKeys.json + */ + /** + * Sample code: Create a VM with securityType ConfidentialVM with Customer Managed Keys. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithSecurityTypeConfidentialVMWithCustomerManagedKeys( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile().withVmSize(VirtualMachineSizeTypes.fromString("Standard_DC2as_v5"))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.DISK_WITH_VMGUEST_STATE) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting patchMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingPatchModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings().withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a vm with managed boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithManagedBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a vm with DiskEncryptionSet resource id in the os disk and data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"))), + new DataDisk() + .withLun(1) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.ATTACH) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } +} +``` + +### VirtualMachines_Deallocate + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Deallocate. */ +public final class VirtualMachinesDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().deallocate("rgcompute", "aaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().deallocate("rgcompute", "aaaaaaaaaa", true, Context.NONE); + } +} +``` + +### VirtualMachines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachine.json + */ + /** + * Sample code: Force delete a VM. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVM(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().delete("myResourceGroup", "myVM", true, Context.NONE); + } +} +``` + +### VirtualMachines_Generalize + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Generalize. */ +public final class VirtualMachinesGeneralizeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GeneralizeVirtualMachine.json + */ + /** + * Sample code: Generalize a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void generalizeAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().generalizeWithResponse("myResourceGroup", "myVMName", Context.NONE); + } +} +``` + +### VirtualMachines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineWithVMSizeProperties.json + */ + /** + * Sample code: Get a virtual machine with VM Size Properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachine.json + */ + /** + * Sample code: Get a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } +} +``` + +### VirtualMachines_InstallPatches + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchClassificationWindows; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchRebootSetting; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.WindowsParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for VirtualMachines InstallPatches. */ +public final class VirtualMachinesInstallPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineInstallPatches.json + */ + /** + * Sample code: Install patch state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void installPatchStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .installPatches( + "myResourceGroupName", + "myVMName", + new VirtualMachineInstallPatchesParameters() + .withMaximumDuration("PT4H") + .withRebootSetting(VMGuestPatchRebootSetting.IF_REQUIRED) + .withWindowsParameters( + new WindowsParameters() + .withClassificationsToInclude( + Arrays + .asList( + VMGuestPatchClassificationWindows.CRITICAL, + VMGuestPatchClassificationWindows.SECURITY)) + .withMaxPatchPublishDate(OffsetDateTime.parse("2020-11-19T02:36:43.0539904+00:00"))), + Context.NONE); + } +} +``` + +### VirtualMachines_InstanceView + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines InstanceView. */ +public final class VirtualMachinesInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineInstanceView.json + */ + /** + * Sample code: Get Virtual Machine Instance View. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineInstanceView( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } +} +``` + +### VirtualMachines_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines List. */ +public final class VirtualMachinesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ListAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ListAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ListAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ListAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().list("aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachines_ListAvailableSizes + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListAvailableSizes. */ +public final class VirtualMachinesListAvailableSizesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListAvailableVmSizes_VirtualMachines.json + */ + /** + * Sample code: Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listAvailableSizes("myResourceGroup", "myVmName", Context.NONE); + } +} +``` + +### VirtualMachines_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByLocation. */ +public final class VirtualMachinesListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachinesInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the virtual machines under the specified subscription for the specified location. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByLocation("eastus", Context.NONE); + } +} +``` + +### VirtualMachines_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByResourceGroup. */ +public final class VirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByResourceGroup("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByResourceGroup("rgcompute", null, Context.NONE); + } +} +``` + +### VirtualMachines_PerformMaintenance + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines PerformMaintenance. */ +public final class VirtualMachinesPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().performMaintenance("rgcompute", "aaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().performMaintenance("rgcompute", "aaaaaaa", Context.NONE); + } +} +``` + +### VirtualMachines_PowerOff + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines PowerOff. */ +public final class VirtualMachinesPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().powerOff("rgcompute", "aaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().powerOff("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", true, Context.NONE); + } +} +``` + +### VirtualMachines_Reapply + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Reapply. */ +public final class VirtualMachinesReapplySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ReapplyVirtualMachine.json + */ + /** + * Sample code: Reapply the state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void reapplyTheStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().reapply("ResourceGroup", "VMName", Context.NONE); + } +} +``` + +### VirtualMachines_Redeploy + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Redeploy. */ +public final class VirtualMachinesRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().redeploy("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().redeploy("rgcompute", "a", Context.NONE); + } +} +``` + +### VirtualMachines_Reimage + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; + +/** Samples for VirtualMachines Reimage. */ +public final class VirtualMachinesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ReimageVirtualMachine.json + */ + /** + * Sample code: Reimage a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .reimage( + "myResourceGroup", "myVMName", new VirtualMachineReimageParameters().withTempDisk(true), Context.NONE); + } +} +``` + +### VirtualMachines_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Restart. */ +public final class VirtualMachinesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().restart("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().restart("rgcompute", "aaa", Context.NONE); + } +} +``` + +### VirtualMachines_RetrieveBootDiagnosticsData + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines RetrieveBootDiagnosticsData. */ +public final class VirtualMachinesRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RetrieveBootDiagnosticsDataVirtualMachine.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "VMName", 60, Context.NONE); + } +} +``` + +### VirtualMachines_RunCommand + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; + +/** Samples for VirtualMachines RunCommand. */ +public final class VirtualMachinesRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommand.json + */ + /** + * Sample code: VirtualMachineRunCommand. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .runCommand( + "crptestar98131", "vm3036", new RunCommandInput().withCommandId("RunPowerShellScript"), Context.NONE); + } +} +``` + +### VirtualMachines_SimulateEviction + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines SimulateEviction. */ +public final class VirtualMachinesSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SimulateEvictionOfVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void simulateEvictionAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().simulateEvictionWithResponse("ResourceGroup", "VMName", Context.NONE); + } +} +``` + +### VirtualMachines_Start + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().start("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().start("rgcompute", "aaaaa", Context.NONE); + } +} +``` + +### VirtualMachines_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDetachOptionTypes; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachine; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import java.util.Arrays; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ + /** + * Sample code: Update a VM by detaching data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAVMByDetachingDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachine resource = + manager + .virtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE) + .getValue(); + resource + .update() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMForceDetachDataDisk.json + */ + /** + * Sample code: Update a VM by force-detaching data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAVMByForceDetachingDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachine resource = + manager + .virtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE) + .getValue(); + resource + .update() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true) + .withDetachOption(DiskDetachOptionTypes.FORCE_DETACH), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .apply(); + } +} +``` + diff --git a/sdk/compute/azure-resourcemanager-compute-generated/pom.xml b/sdk/compute/azure-resourcemanager-compute-generated/pom.xml new file mode 100644 index 0000000000000..609dfea597c9e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-compute-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Compute Management + This package contains Microsoft Azure SDK for Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Compute Client. Package tag package-2021-11-01. + 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 + true + + + + com.azure + azure-core + 1.24.1 + + + com.azure + azure-core-management + 1.5.1 + + + diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/ComputeManager.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/ComputeManager.java new file mode 100644 index 0000000000000..de225c1b45261 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/ComputeManager.java @@ -0,0 +1,841 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +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.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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.ComputeManagementClient; +import com.azure.resourcemanager.compute.generated.implementation.AvailabilitySetsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CapacityReservationGroupsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CapacityReservationsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CloudServiceOperatingSystemsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CloudServiceRoleInstancesImpl; +import com.azure.resourcemanager.compute.generated.implementation.CloudServiceRolesImpl; +import com.azure.resourcemanager.compute.generated.implementation.CloudServicesImpl; +import com.azure.resourcemanager.compute.generated.implementation.CloudServicesUpdateDomainsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CommunityGalleriesImpl; +import com.azure.resourcemanager.compute.generated.implementation.CommunityGalleryImageVersionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.CommunityGalleryImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.ComputeManagementClientBuilder; +import com.azure.resourcemanager.compute.generated.implementation.DedicatedHostGroupsImpl; +import com.azure.resourcemanager.compute.generated.implementation.DedicatedHostsImpl; +import com.azure.resourcemanager.compute.generated.implementation.DiskAccessesImpl; +import com.azure.resourcemanager.compute.generated.implementation.DiskEncryptionSetsImpl; +import com.azure.resourcemanager.compute.generated.implementation.DiskRestorePointsImpl; +import com.azure.resourcemanager.compute.generated.implementation.DisksImpl; +import com.azure.resourcemanager.compute.generated.implementation.GalleriesImpl; +import com.azure.resourcemanager.compute.generated.implementation.GalleryApplicationVersionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.GalleryApplicationsImpl; +import com.azure.resourcemanager.compute.generated.implementation.GalleryImageVersionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.GalleryImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.GallerySharingProfilesImpl; +import com.azure.resourcemanager.compute.generated.implementation.ImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.LogAnalyticsImpl; +import com.azure.resourcemanager.compute.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.compute.generated.implementation.ProximityPlacementGroupsImpl; +import com.azure.resourcemanager.compute.generated.implementation.ResourceSkusImpl; +import com.azure.resourcemanager.compute.generated.implementation.RestorePointCollectionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.RestorePointsImpl; +import com.azure.resourcemanager.compute.generated.implementation.SharedGalleriesImpl; +import com.azure.resourcemanager.compute.generated.implementation.SharedGalleryImageVersionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.SharedGalleryImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.SnapshotsImpl; +import com.azure.resourcemanager.compute.generated.implementation.SshPublicKeysImpl; +import com.azure.resourcemanager.compute.generated.implementation.UsagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineExtensionImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineExtensionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineImagesEdgeZonesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineImagesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineRunCommandsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetExtensionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetRollingUpgradesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetVMExtensionsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetVMRunCommandsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetVMsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineScaleSetsImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachineSizesImpl; +import com.azure.resourcemanager.compute.generated.implementation.VirtualMachinesImpl; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySets; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroups; +import com.azure.resourcemanager.compute.generated.models.CapacityReservations; +import com.azure.resourcemanager.compute.generated.models.CloudServiceOperatingSystems; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleInstances; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoles; +import com.azure.resourcemanager.compute.generated.models.CloudServices; +import com.azure.resourcemanager.compute.generated.models.CloudServicesUpdateDomains; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleries; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImageVersions; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImages; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroups; +import com.azure.resourcemanager.compute.generated.models.DedicatedHosts; +import com.azure.resourcemanager.compute.generated.models.DiskAccesses; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSets; +import com.azure.resourcemanager.compute.generated.models.DiskRestorePoints; +import com.azure.resourcemanager.compute.generated.models.Disks; +import com.azure.resourcemanager.compute.generated.models.Galleries; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersions; +import com.azure.resourcemanager.compute.generated.models.GalleryApplications; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersions; +import com.azure.resourcemanager.compute.generated.models.GalleryImages; +import com.azure.resourcemanager.compute.generated.models.GallerySharingProfiles; +import com.azure.resourcemanager.compute.generated.models.Images; +import com.azure.resourcemanager.compute.generated.models.LogAnalytics; +import com.azure.resourcemanager.compute.generated.models.Operations; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroups; +import com.azure.resourcemanager.compute.generated.models.ResourceSkus; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollections; +import com.azure.resourcemanager.compute.generated.models.RestorePoints; +import com.azure.resourcemanager.compute.generated.models.SharedGalleries; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageVersions; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImages; +import com.azure.resourcemanager.compute.generated.models.Snapshots; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeys; +import com.azure.resourcemanager.compute.generated.models.Usages; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionImages; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImages; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImagesEdgeZones; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommands; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetRollingUpgrades; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMRunCommands; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSets; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachines; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ComputeManager. Compute Client. */ +public final class ComputeManager { + private Operations operations; + + private AvailabilitySets availabilitySets; + + private ProximityPlacementGroups proximityPlacementGroups; + + private DedicatedHostGroups dedicatedHostGroups; + + private DedicatedHosts dedicatedHosts; + + private SshPublicKeys sshPublicKeys; + + private VirtualMachineExtensionImages virtualMachineExtensionImages; + + private VirtualMachineExtensions virtualMachineExtensions; + + private VirtualMachineImages virtualMachineImages; + + private VirtualMachineImagesEdgeZones virtualMachineImagesEdgeZones; + + private Usages usages; + + private VirtualMachines virtualMachines; + + private VirtualMachineScaleSets virtualMachineScaleSets; + + private VirtualMachineSizes virtualMachineSizes; + + private Images images; + + private RestorePointCollections restorePointCollections; + + private RestorePoints restorePoints; + + private CapacityReservationGroups capacityReservationGroups; + + private CapacityReservations capacityReservations; + + private VirtualMachineScaleSetExtensions virtualMachineScaleSetExtensions; + + private VirtualMachineScaleSetRollingUpgrades virtualMachineScaleSetRollingUpgrades; + + private VirtualMachineScaleSetVMExtensions virtualMachineScaleSetVMExtensions; + + private VirtualMachineScaleSetVMs virtualMachineScaleSetVMs; + + private LogAnalytics logAnalytics; + + private VirtualMachineRunCommands virtualMachineRunCommands; + + private VirtualMachineScaleSetVMRunCommands virtualMachineScaleSetVMRunCommands; + + private ResourceSkus resourceSkus; + + private Disks disks; + + private Snapshots snapshots; + + private DiskEncryptionSets diskEncryptionSets; + + private DiskAccesses diskAccesses; + + private DiskRestorePoints diskRestorePoints; + + private Galleries galleries; + + private GalleryImages galleryImages; + + private GalleryImageVersions galleryImageVersions; + + private GalleryApplications galleryApplications; + + private GalleryApplicationVersions galleryApplicationVersions; + + private GallerySharingProfiles gallerySharingProfiles; + + private SharedGalleries sharedGalleries; + + private SharedGalleryImages sharedGalleryImages; + + private SharedGalleryImageVersions sharedGalleryImageVersions; + + private CommunityGalleries communityGalleries; + + private CommunityGalleryImages communityGalleryImages; + + private CommunityGalleryImageVersions communityGalleryImageVersions; + + private CloudServiceRoleInstances cloudServiceRoleInstances; + + private CloudServiceRoles cloudServiceRoles; + + private CloudServices cloudServices; + + private CloudServicesUpdateDomains cloudServicesUpdateDomains; + + private CloudServiceOperatingSystems cloudServiceOperatingSystems; + + private final ComputeManagementClient clientObject; + + private ComputeManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ComputeManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Compute service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Compute service API instance. + */ + public static ComputeManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ComputeManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ComputeManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Compute service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Compute service API instance. + */ + public ComputeManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.compute.generated") + .append("/") + .append("1.0.0-beta.1"); + 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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 ArmChallengeAuthenticationPolicy(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 ComputeManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of AvailabilitySets. */ + public AvailabilitySets availabilitySets() { + if (this.availabilitySets == null) { + this.availabilitySets = new AvailabilitySetsImpl(clientObject.getAvailabilitySets(), this); + } + return availabilitySets; + } + + /** @return Resource collection API of ProximityPlacementGroups. */ + public ProximityPlacementGroups proximityPlacementGroups() { + if (this.proximityPlacementGroups == null) { + this.proximityPlacementGroups = + new ProximityPlacementGroupsImpl(clientObject.getProximityPlacementGroups(), this); + } + return proximityPlacementGroups; + } + + /** @return Resource collection API of DedicatedHostGroups. */ + public DedicatedHostGroups dedicatedHostGroups() { + if (this.dedicatedHostGroups == null) { + this.dedicatedHostGroups = new DedicatedHostGroupsImpl(clientObject.getDedicatedHostGroups(), this); + } + return dedicatedHostGroups; + } + + /** @return Resource collection API of DedicatedHosts. */ + public DedicatedHosts dedicatedHosts() { + if (this.dedicatedHosts == null) { + this.dedicatedHosts = new DedicatedHostsImpl(clientObject.getDedicatedHosts(), this); + } + return dedicatedHosts; + } + + /** @return Resource collection API of SshPublicKeys. */ + public SshPublicKeys sshPublicKeys() { + if (this.sshPublicKeys == null) { + this.sshPublicKeys = new SshPublicKeysImpl(clientObject.getSshPublicKeys(), this); + } + return sshPublicKeys; + } + + /** @return Resource collection API of VirtualMachineExtensionImages. */ + public VirtualMachineExtensionImages virtualMachineExtensionImages() { + if (this.virtualMachineExtensionImages == null) { + this.virtualMachineExtensionImages = + new VirtualMachineExtensionImagesImpl(clientObject.getVirtualMachineExtensionImages(), this); + } + return virtualMachineExtensionImages; + } + + /** @return Resource collection API of VirtualMachineExtensions. */ + public VirtualMachineExtensions virtualMachineExtensions() { + if (this.virtualMachineExtensions == null) { + this.virtualMachineExtensions = + new VirtualMachineExtensionsImpl(clientObject.getVirtualMachineExtensions(), this); + } + return virtualMachineExtensions; + } + + /** @return Resource collection API of VirtualMachineImages. */ + public VirtualMachineImages virtualMachineImages() { + if (this.virtualMachineImages == null) { + this.virtualMachineImages = new VirtualMachineImagesImpl(clientObject.getVirtualMachineImages(), this); + } + return virtualMachineImages; + } + + /** @return Resource collection API of VirtualMachineImagesEdgeZones. */ + public VirtualMachineImagesEdgeZones virtualMachineImagesEdgeZones() { + if (this.virtualMachineImagesEdgeZones == null) { + this.virtualMachineImagesEdgeZones = + new VirtualMachineImagesEdgeZonesImpl(clientObject.getVirtualMachineImagesEdgeZones(), this); + } + return virtualMachineImagesEdgeZones; + } + + /** @return Resource collection API of Usages. */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** @return Resource collection API of VirtualMachines. */ + public VirtualMachines virtualMachines() { + if (this.virtualMachines == null) { + this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this); + } + return virtualMachines; + } + + /** @return Resource collection API of VirtualMachineScaleSets. */ + public VirtualMachineScaleSets virtualMachineScaleSets() { + if (this.virtualMachineScaleSets == null) { + this.virtualMachineScaleSets = + new VirtualMachineScaleSetsImpl(clientObject.getVirtualMachineScaleSets(), this); + } + return virtualMachineScaleSets; + } + + /** @return Resource collection API of VirtualMachineSizes. */ + public VirtualMachineSizes virtualMachineSizes() { + if (this.virtualMachineSizes == null) { + this.virtualMachineSizes = new VirtualMachineSizesImpl(clientObject.getVirtualMachineSizes(), this); + } + return virtualMachineSizes; + } + + /** @return Resource collection API of Images. */ + public Images images() { + if (this.images == null) { + this.images = new ImagesImpl(clientObject.getImages(), this); + } + return images; + } + + /** @return Resource collection API of RestorePointCollections. */ + public RestorePointCollections restorePointCollections() { + if (this.restorePointCollections == null) { + this.restorePointCollections = + new RestorePointCollectionsImpl(clientObject.getRestorePointCollections(), this); + } + return restorePointCollections; + } + + /** @return Resource collection API of RestorePoints. */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(clientObject.getRestorePoints(), this); + } + return restorePoints; + } + + /** @return Resource collection API of CapacityReservationGroups. */ + public CapacityReservationGroups capacityReservationGroups() { + if (this.capacityReservationGroups == null) { + this.capacityReservationGroups = + new CapacityReservationGroupsImpl(clientObject.getCapacityReservationGroups(), this); + } + return capacityReservationGroups; + } + + /** @return Resource collection API of CapacityReservations. */ + public CapacityReservations capacityReservations() { + if (this.capacityReservations == null) { + this.capacityReservations = new CapacityReservationsImpl(clientObject.getCapacityReservations(), this); + } + return capacityReservations; + } + + /** @return Resource collection API of VirtualMachineScaleSetExtensions. */ + public VirtualMachineScaleSetExtensions virtualMachineScaleSetExtensions() { + if (this.virtualMachineScaleSetExtensions == null) { + this.virtualMachineScaleSetExtensions = + new VirtualMachineScaleSetExtensionsImpl(clientObject.getVirtualMachineScaleSetExtensions(), this); + } + return virtualMachineScaleSetExtensions; + } + + /** @return Resource collection API of VirtualMachineScaleSetRollingUpgrades. */ + public VirtualMachineScaleSetRollingUpgrades virtualMachineScaleSetRollingUpgrades() { + if (this.virtualMachineScaleSetRollingUpgrades == null) { + this.virtualMachineScaleSetRollingUpgrades = + new VirtualMachineScaleSetRollingUpgradesImpl( + clientObject.getVirtualMachineScaleSetRollingUpgrades(), this); + } + return virtualMachineScaleSetRollingUpgrades; + } + + /** @return Resource collection API of VirtualMachineScaleSetVMExtensions. */ + public VirtualMachineScaleSetVMExtensions virtualMachineScaleSetVMExtensions() { + if (this.virtualMachineScaleSetVMExtensions == null) { + this.virtualMachineScaleSetVMExtensions = + new VirtualMachineScaleSetVMExtensionsImpl(clientObject.getVirtualMachineScaleSetVMExtensions(), this); + } + return virtualMachineScaleSetVMExtensions; + } + + /** @return Resource collection API of VirtualMachineScaleSetVMs. */ + public VirtualMachineScaleSetVMs virtualMachineScaleSetVMs() { + if (this.virtualMachineScaleSetVMs == null) { + this.virtualMachineScaleSetVMs = + new VirtualMachineScaleSetVMsImpl(clientObject.getVirtualMachineScaleSetVMs(), this); + } + return virtualMachineScaleSetVMs; + } + + /** @return Resource collection API of LogAnalytics. */ + public LogAnalytics logAnalytics() { + if (this.logAnalytics == null) { + this.logAnalytics = new LogAnalyticsImpl(clientObject.getLogAnalytics(), this); + } + return logAnalytics; + } + + /** @return Resource collection API of VirtualMachineRunCommands. */ + public VirtualMachineRunCommands virtualMachineRunCommands() { + if (this.virtualMachineRunCommands == null) { + this.virtualMachineRunCommands = + new VirtualMachineRunCommandsImpl(clientObject.getVirtualMachineRunCommands(), this); + } + return virtualMachineRunCommands; + } + + /** @return Resource collection API of VirtualMachineScaleSetVMRunCommands. */ + public VirtualMachineScaleSetVMRunCommands virtualMachineScaleSetVMRunCommands() { + if (this.virtualMachineScaleSetVMRunCommands == null) { + this.virtualMachineScaleSetVMRunCommands = + new VirtualMachineScaleSetVMRunCommandsImpl( + clientObject.getVirtualMachineScaleSetVMRunCommands(), this); + } + return virtualMachineScaleSetVMRunCommands; + } + + /** @return Resource collection API of ResourceSkus. */ + public ResourceSkus resourceSkus() { + if (this.resourceSkus == null) { + this.resourceSkus = new ResourceSkusImpl(clientObject.getResourceSkus(), this); + } + return resourceSkus; + } + + /** @return Resource collection API of Disks. */ + public Disks disks() { + if (this.disks == null) { + this.disks = new DisksImpl(clientObject.getDisks(), this); + } + return disks; + } + + /** @return Resource collection API of Snapshots. */ + public Snapshots snapshots() { + if (this.snapshots == null) { + this.snapshots = new SnapshotsImpl(clientObject.getSnapshots(), this); + } + return snapshots; + } + + /** @return Resource collection API of DiskEncryptionSets. */ + public DiskEncryptionSets diskEncryptionSets() { + if (this.diskEncryptionSets == null) { + this.diskEncryptionSets = new DiskEncryptionSetsImpl(clientObject.getDiskEncryptionSets(), this); + } + return diskEncryptionSets; + } + + /** @return Resource collection API of DiskAccesses. */ + public DiskAccesses diskAccesses() { + if (this.diskAccesses == null) { + this.diskAccesses = new DiskAccessesImpl(clientObject.getDiskAccesses(), this); + } + return diskAccesses; + } + + /** @return Resource collection API of DiskRestorePoints. */ + public DiskRestorePoints diskRestorePoints() { + if (this.diskRestorePoints == null) { + this.diskRestorePoints = new DiskRestorePointsImpl(clientObject.getDiskRestorePoints(), this); + } + return diskRestorePoints; + } + + /** @return Resource collection API of Galleries. */ + public Galleries galleries() { + if (this.galleries == null) { + this.galleries = new GalleriesImpl(clientObject.getGalleries(), this); + } + return galleries; + } + + /** @return Resource collection API of GalleryImages. */ + public GalleryImages galleryImages() { + if (this.galleryImages == null) { + this.galleryImages = new GalleryImagesImpl(clientObject.getGalleryImages(), this); + } + return galleryImages; + } + + /** @return Resource collection API of GalleryImageVersions. */ + public GalleryImageVersions galleryImageVersions() { + if (this.galleryImageVersions == null) { + this.galleryImageVersions = new GalleryImageVersionsImpl(clientObject.getGalleryImageVersions(), this); + } + return galleryImageVersions; + } + + /** @return Resource collection API of GalleryApplications. */ + public GalleryApplications galleryApplications() { + if (this.galleryApplications == null) { + this.galleryApplications = new GalleryApplicationsImpl(clientObject.getGalleryApplications(), this); + } + return galleryApplications; + } + + /** @return Resource collection API of GalleryApplicationVersions. */ + public GalleryApplicationVersions galleryApplicationVersions() { + if (this.galleryApplicationVersions == null) { + this.galleryApplicationVersions = + new GalleryApplicationVersionsImpl(clientObject.getGalleryApplicationVersions(), this); + } + return galleryApplicationVersions; + } + + /** @return Resource collection API of GallerySharingProfiles. */ + public GallerySharingProfiles gallerySharingProfiles() { + if (this.gallerySharingProfiles == null) { + this.gallerySharingProfiles = + new GallerySharingProfilesImpl(clientObject.getGallerySharingProfiles(), this); + } + return gallerySharingProfiles; + } + + /** @return Resource collection API of SharedGalleries. */ + public SharedGalleries sharedGalleries() { + if (this.sharedGalleries == null) { + this.sharedGalleries = new SharedGalleriesImpl(clientObject.getSharedGalleries(), this); + } + return sharedGalleries; + } + + /** @return Resource collection API of SharedGalleryImages. */ + public SharedGalleryImages sharedGalleryImages() { + if (this.sharedGalleryImages == null) { + this.sharedGalleryImages = new SharedGalleryImagesImpl(clientObject.getSharedGalleryImages(), this); + } + return sharedGalleryImages; + } + + /** @return Resource collection API of SharedGalleryImageVersions. */ + public SharedGalleryImageVersions sharedGalleryImageVersions() { + if (this.sharedGalleryImageVersions == null) { + this.sharedGalleryImageVersions = + new SharedGalleryImageVersionsImpl(clientObject.getSharedGalleryImageVersions(), this); + } + return sharedGalleryImageVersions; + } + + /** @return Resource collection API of CommunityGalleries. */ + public CommunityGalleries communityGalleries() { + if (this.communityGalleries == null) { + this.communityGalleries = new CommunityGalleriesImpl(clientObject.getCommunityGalleries(), this); + } + return communityGalleries; + } + + /** @return Resource collection API of CommunityGalleryImages. */ + public CommunityGalleryImages communityGalleryImages() { + if (this.communityGalleryImages == null) { + this.communityGalleryImages = + new CommunityGalleryImagesImpl(clientObject.getCommunityGalleryImages(), this); + } + return communityGalleryImages; + } + + /** @return Resource collection API of CommunityGalleryImageVersions. */ + public CommunityGalleryImageVersions communityGalleryImageVersions() { + if (this.communityGalleryImageVersions == null) { + this.communityGalleryImageVersions = + new CommunityGalleryImageVersionsImpl(clientObject.getCommunityGalleryImageVersions(), this); + } + return communityGalleryImageVersions; + } + + /** @return Resource collection API of CloudServiceRoleInstances. */ + public CloudServiceRoleInstances cloudServiceRoleInstances() { + if (this.cloudServiceRoleInstances == null) { + this.cloudServiceRoleInstances = + new CloudServiceRoleInstancesImpl(clientObject.getCloudServiceRoleInstances(), this); + } + return cloudServiceRoleInstances; + } + + /** @return Resource collection API of CloudServiceRoles. */ + public CloudServiceRoles cloudServiceRoles() { + if (this.cloudServiceRoles == null) { + this.cloudServiceRoles = new CloudServiceRolesImpl(clientObject.getCloudServiceRoles(), this); + } + return cloudServiceRoles; + } + + /** @return Resource collection API of CloudServices. */ + public CloudServices cloudServices() { + if (this.cloudServices == null) { + this.cloudServices = new CloudServicesImpl(clientObject.getCloudServices(), this); + } + return cloudServices; + } + + /** @return Resource collection API of CloudServicesUpdateDomains. */ + public CloudServicesUpdateDomains cloudServicesUpdateDomains() { + if (this.cloudServicesUpdateDomains == null) { + this.cloudServicesUpdateDomains = + new CloudServicesUpdateDomainsImpl(clientObject.getCloudServicesUpdateDomains(), this); + } + return cloudServicesUpdateDomains; + } + + /** @return Resource collection API of CloudServiceOperatingSystems. */ + public CloudServiceOperatingSystems cloudServiceOperatingSystems() { + if (this.cloudServiceOperatingSystems == null) { + this.cloudServiceOperatingSystems = + new CloudServiceOperatingSystemsImpl(clientObject.getCloudServiceOperatingSystems(), this); + } + return cloudServiceOperatingSystems; + } + + /** + * @return Wrapped service client ComputeManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public ComputeManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/AvailabilitySetsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/AvailabilitySetsClient.java new file mode 100644 index 0000000000000..01ffb2e607597 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/AvailabilitySetsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySetUpdate; + +/** An instance of this class provides access to all the operations defined in AvailabilitySetsClient. */ +public interface AvailabilitySetsClient { + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters); + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters, Context context); + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner update(String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters); + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters, Context context); + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 availabilitySetName); + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String availabilitySetName, Context context); + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName); + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context); + + /** + * Lists all availability sets in a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, Context context); + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAvailableSizes(String resourceGroupName, String availabilitySetName); + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAvailableSizes( + String resourceGroupName, String availabilitySetName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationGroupsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationGroupsClient.java new file mode 100644 index 0000000000000..c79ea9706f51b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationGroupsClient.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CapacityReservationGroupInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; + +/** An instance of this class provides access to all the operations defined in CapacityReservationGroupsClient. */ +public interface CapacityReservationGroupsClient { + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationGroupInner createOrUpdate( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupInner parameters); + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInner parameters, + Context context); + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationGroupInner update( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupUpdate parameters); + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupUpdate parameters, + Context context); + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName); + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String capacityReservationGroupName, Context context); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationGroupInner getByResourceGroup(String resourceGroupName, String capacityReservationGroupName); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand, + Context context); + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context); + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + ExpandTypesForGetCapacityReservationGroups expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationsClient.java new file mode 100644 index 0000000000000..62bfab485e236 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CapacityReservationsClient.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CapacityReservationInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapacityReservationsClient. */ +public interface CapacityReservationsClient { + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CapacityReservationInner> beginCreateOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters); + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CapacityReservationInner> beginCreateOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context); + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationInner createOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters); + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationInner createOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context); + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CapacityReservationInner> beginUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters); + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CapacityReservationInner> beginUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context); + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationInner update( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters); + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationInner update( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName, Context context); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName, String capacityReservationName); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName, String capacityReservationName, Context context); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapacityReservationInner get( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand, + Context context); + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName); + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceOperatingSystemsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceOperatingSystemsClient.java new file mode 100644 index 0000000000000..e693802c57f15 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceOperatingSystemsClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.OSFamilyInner; +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; + +/** An instance of this class provides access to all the operations defined in CloudServiceOperatingSystemsClient. */ +public interface CloudServiceOperatingSystemsClient { + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OSVersionInner getOSVersion(String location, String osVersionName); + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOSVersionWithResponse(String location, String osVersionName, Context context); + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOSVersions(String location); + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOSVersions(String location, Context context); + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OSFamilyInner getOSFamily(String location, String osFamilyName); + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOSFamilyWithResponse(String location, String osFamilyName, Context context); + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOSFamilies(String location); + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOSFamilies(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRoleInstancesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRoleInstancesClient.java new file mode 100644 index 0000000000000..d15301ea70019 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRoleInstancesClient.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.http.rest.StreamResponse; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import java.io.InputStream; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServiceRoleInstancesClient. */ +public interface CloudServiceRoleInstancesClient { + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInstanceInner get(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String roleInstanceName, + String resourceGroupName, + String cloudServiceName, + InstanceViewTypes expand, + Context context); + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleInstanceViewInner getInstanceView(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInstanceViewWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cloudServiceName); + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRebuild( + String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRebuild( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InputStream getRemoteDesktopFile(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StreamResponse getRemoteDesktopFileWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRolesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRolesClient.java new file mode 100644 index 0000000000000..18b2106e3d5d7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServiceRolesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CloudServiceRoleInner; + +/** An instance of this class provides access to all the operations defined in CloudServiceRolesClient. */ +public interface CloudServiceRolesClient { + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceRoleInner get(String roleName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String roleName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cloudServiceName); + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesClient.java new file mode 100644 index 0000000000000..29994381254a9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesClient.java @@ -0,0 +1,779 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CloudServiceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceUpdate; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServicesClient. */ +public interface CloudServicesClient { + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudServiceInner> beginCreateOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters); + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudServiceInner> beginCreateOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context); + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner createOrUpdate(String resourceGroupName, String cloudServiceName, CloudServiceInner parameters); + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner createOrUpdate(String resourceGroupName, String cloudServiceName); + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner createOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context); + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudServiceInner> beginUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters); + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudServiceInner> beginUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context); + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner update(String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters); + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner update(String resourceGroupName, String cloudServiceName); + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner update( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context); + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudServiceName); + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudServiceName, Context context); + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cloudServiceName); + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cloudServiceName, Context context); + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInner getByResourceGroup(String resourceGroupName, String cloudServiceName); + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudServiceInstanceViewInner getInstanceView(String resourceGroupName, String cloudServiceName); + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInstanceViewWithResponse( + String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String cloudServiceName); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String cloudServiceName, Context context); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, Context context); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff(String resourceGroupName, String cloudServiceName); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, String cloudServiceName, Context context); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String cloudServiceName); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String cloudServiceName, Context context); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRebuild( + String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRebuild( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances(String resourceGroupName, String cloudServiceName); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesUpdateDomainsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesUpdateDomainsClient.java new file mode 100644 index 0000000000000..a8a5b437c752a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CloudServicesUpdateDomainsClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.UpdateDomainInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServicesUpdateDomainsClient. */ +public interface CloudServicesUpdateDomainsClient { + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginWalkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginWalkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 walkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 walkUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 walkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context); + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 update domain of a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateDomainInner getUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain); + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 update domain of a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getUpdateDomainWithResponse( + String resourceGroupName, String cloudServiceName, int updateDomain, Context context); + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUpdateDomains(String resourceGroupName, String cloudServiceName); + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUpdateDomains( + String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleriesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleriesClient.java new file mode 100644 index 0000000000000..fef4ed14f6b5b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleriesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CommunityGalleryInner; + +/** An instance of this class provides access to all the operations defined in CommunityGalleriesClient. */ +public interface CommunityGalleriesClient { + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityGalleryInner get(String location, String publicGalleryName); + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String publicGalleryName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImageVersionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImageVersionsClient.java new file mode 100644 index 0000000000000..d205826fca0cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImageVersionsClient.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CommunityGalleryImageVersionInner; + +/** An instance of this class provides access to all the operations defined in CommunityGalleryImageVersionsClient. */ +public interface CommunityGalleryImageVersionsClient { + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityGalleryImageVersionInner get( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, + String publicGalleryName, + String galleryImageName, + String galleryImageVersionName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImagesClient.java new file mode 100644 index 0000000000000..daf4bdd4652f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/CommunityGalleryImagesClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.CommunityGalleryImageInner; + +/** An instance of this class provides access to all the operations defined in CommunityGalleryImagesClient. */ +public interface CommunityGalleryImagesClient { + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityGalleryImageInner get(String location, String publicGalleryName, String galleryImageName); + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, String publicGalleryName, String galleryImageName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ComputeManagementClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ComputeManagementClient.java new file mode 100644 index 0000000000000..b2da29dac9f6b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ComputeManagementClient.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ComputeManagementClient class. */ +public interface ComputeManagementClient { + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AvailabilitySetsClient object to access its operations. + * + * @return the AvailabilitySetsClient object. + */ + AvailabilitySetsClient getAvailabilitySets(); + + /** + * Gets the ProximityPlacementGroupsClient object to access its operations. + * + * @return the ProximityPlacementGroupsClient object. + */ + ProximityPlacementGroupsClient getProximityPlacementGroups(); + + /** + * Gets the DedicatedHostGroupsClient object to access its operations. + * + * @return the DedicatedHostGroupsClient object. + */ + DedicatedHostGroupsClient getDedicatedHostGroups(); + + /** + * Gets the DedicatedHostsClient object to access its operations. + * + * @return the DedicatedHostsClient object. + */ + DedicatedHostsClient getDedicatedHosts(); + + /** + * Gets the SshPublicKeysClient object to access its operations. + * + * @return the SshPublicKeysClient object. + */ + SshPublicKeysClient getSshPublicKeys(); + + /** + * Gets the VirtualMachineExtensionImagesClient object to access its operations. + * + * @return the VirtualMachineExtensionImagesClient object. + */ + VirtualMachineExtensionImagesClient getVirtualMachineExtensionImages(); + + /** + * Gets the VirtualMachineExtensionsClient object to access its operations. + * + * @return the VirtualMachineExtensionsClient object. + */ + VirtualMachineExtensionsClient getVirtualMachineExtensions(); + + /** + * Gets the VirtualMachineImagesClient object to access its operations. + * + * @return the VirtualMachineImagesClient object. + */ + VirtualMachineImagesClient getVirtualMachineImages(); + + /** + * Gets the VirtualMachineImagesEdgeZonesClient object to access its operations. + * + * @return the VirtualMachineImagesEdgeZonesClient object. + */ + VirtualMachineImagesEdgeZonesClient getVirtualMachineImagesEdgeZones(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + VirtualMachinesClient getVirtualMachines(); + + /** + * Gets the VirtualMachineScaleSetsClient object to access its operations. + * + * @return the VirtualMachineScaleSetsClient object. + */ + VirtualMachineScaleSetsClient getVirtualMachineScaleSets(); + + /** + * Gets the VirtualMachineSizesClient object to access its operations. + * + * @return the VirtualMachineSizesClient object. + */ + VirtualMachineSizesClient getVirtualMachineSizes(); + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + ImagesClient getImages(); + + /** + * Gets the RestorePointCollectionsClient object to access its operations. + * + * @return the RestorePointCollectionsClient object. + */ + RestorePointCollectionsClient getRestorePointCollections(); + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + RestorePointsClient getRestorePoints(); + + /** + * Gets the CapacityReservationGroupsClient object to access its operations. + * + * @return the CapacityReservationGroupsClient object. + */ + CapacityReservationGroupsClient getCapacityReservationGroups(); + + /** + * Gets the CapacityReservationsClient object to access its operations. + * + * @return the CapacityReservationsClient object. + */ + CapacityReservationsClient getCapacityReservations(); + + /** + * Gets the VirtualMachineScaleSetExtensionsClient object to access its operations. + * + * @return the VirtualMachineScaleSetExtensionsClient object. + */ + VirtualMachineScaleSetExtensionsClient getVirtualMachineScaleSetExtensions(); + + /** + * Gets the VirtualMachineScaleSetRollingUpgradesClient object to access its operations. + * + * @return the VirtualMachineScaleSetRollingUpgradesClient object. + */ + VirtualMachineScaleSetRollingUpgradesClient getVirtualMachineScaleSetRollingUpgrades(); + + /** + * Gets the VirtualMachineScaleSetVMExtensionsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMExtensionsClient object. + */ + VirtualMachineScaleSetVMExtensionsClient getVirtualMachineScaleSetVMExtensions(); + + /** + * Gets the VirtualMachineScaleSetVMsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMsClient object. + */ + VirtualMachineScaleSetVMsClient getVirtualMachineScaleSetVMs(); + + /** + * Gets the LogAnalyticsClient object to access its operations. + * + * @return the LogAnalyticsClient object. + */ + LogAnalyticsClient getLogAnalytics(); + + /** + * Gets the VirtualMachineRunCommandsClient object to access its operations. + * + * @return the VirtualMachineRunCommandsClient object. + */ + VirtualMachineRunCommandsClient getVirtualMachineRunCommands(); + + /** + * Gets the VirtualMachineScaleSetVMRunCommandsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMRunCommandsClient object. + */ + VirtualMachineScaleSetVMRunCommandsClient getVirtualMachineScaleSetVMRunCommands(); + + /** + * Gets the ResourceSkusClient object to access its operations. + * + * @return the ResourceSkusClient object. + */ + ResourceSkusClient getResourceSkus(); + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + DisksClient getDisks(); + + /** + * Gets the SnapshotsClient object to access its operations. + * + * @return the SnapshotsClient object. + */ + SnapshotsClient getSnapshots(); + + /** + * Gets the DiskEncryptionSetsClient object to access its operations. + * + * @return the DiskEncryptionSetsClient object. + */ + DiskEncryptionSetsClient getDiskEncryptionSets(); + + /** + * Gets the DiskAccessesClient object to access its operations. + * + * @return the DiskAccessesClient object. + */ + DiskAccessesClient getDiskAccesses(); + + /** + * Gets the DiskRestorePointsClient object to access its operations. + * + * @return the DiskRestorePointsClient object. + */ + DiskRestorePointsClient getDiskRestorePoints(); + + /** + * Gets the GalleriesClient object to access its operations. + * + * @return the GalleriesClient object. + */ + GalleriesClient getGalleries(); + + /** + * Gets the GalleryImagesClient object to access its operations. + * + * @return the GalleryImagesClient object. + */ + GalleryImagesClient getGalleryImages(); + + /** + * Gets the GalleryImageVersionsClient object to access its operations. + * + * @return the GalleryImageVersionsClient object. + */ + GalleryImageVersionsClient getGalleryImageVersions(); + + /** + * Gets the GalleryApplicationsClient object to access its operations. + * + * @return the GalleryApplicationsClient object. + */ + GalleryApplicationsClient getGalleryApplications(); + + /** + * Gets the GalleryApplicationVersionsClient object to access its operations. + * + * @return the GalleryApplicationVersionsClient object. + */ + GalleryApplicationVersionsClient getGalleryApplicationVersions(); + + /** + * Gets the GallerySharingProfilesClient object to access its operations. + * + * @return the GallerySharingProfilesClient object. + */ + GallerySharingProfilesClient getGallerySharingProfiles(); + + /** + * Gets the SharedGalleriesClient object to access its operations. + * + * @return the SharedGalleriesClient object. + */ + SharedGalleriesClient getSharedGalleries(); + + /** + * Gets the SharedGalleryImagesClient object to access its operations. + * + * @return the SharedGalleryImagesClient object. + */ + SharedGalleryImagesClient getSharedGalleryImages(); + + /** + * Gets the SharedGalleryImageVersionsClient object to access its operations. + * + * @return the SharedGalleryImageVersionsClient object. + */ + SharedGalleryImageVersionsClient getSharedGalleryImageVersions(); + + /** + * Gets the CommunityGalleriesClient object to access its operations. + * + * @return the CommunityGalleriesClient object. + */ + CommunityGalleriesClient getCommunityGalleries(); + + /** + * Gets the CommunityGalleryImagesClient object to access its operations. + * + * @return the CommunityGalleryImagesClient object. + */ + CommunityGalleryImagesClient getCommunityGalleryImages(); + + /** + * Gets the CommunityGalleryImageVersionsClient object to access its operations. + * + * @return the CommunityGalleryImageVersionsClient object. + */ + CommunityGalleryImageVersionsClient getCommunityGalleryImageVersions(); + + /** + * Gets the CloudServiceRoleInstancesClient object to access its operations. + * + * @return the CloudServiceRoleInstancesClient object. + */ + CloudServiceRoleInstancesClient getCloudServiceRoleInstances(); + + /** + * Gets the CloudServiceRolesClient object to access its operations. + * + * @return the CloudServiceRolesClient object. + */ + CloudServiceRolesClient getCloudServiceRoles(); + + /** + * Gets the CloudServicesClient object to access its operations. + * + * @return the CloudServicesClient object. + */ + CloudServicesClient getCloudServices(); + + /** + * Gets the CloudServicesUpdateDomainsClient object to access its operations. + * + * @return the CloudServicesUpdateDomainsClient object. + */ + CloudServicesUpdateDomainsClient getCloudServicesUpdateDomains(); + + /** + * Gets the CloudServiceOperatingSystemsClient object to access its operations. + * + * @return the CloudServiceOperatingSystemsClient object. + */ + CloudServiceOperatingSystemsClient getCloudServiceOperatingSystems(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostGroupsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostGroupsClient.java new file mode 100644 index 0000000000000..68a93a6d27bb3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostGroupsClient.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.DedicatedHostGroupInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; + +/** An instance of this class provides access to all the operations defined in DedicatedHostGroupsClient. */ +public interface DedicatedHostGroupsClient { + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostGroupInner createOrUpdate( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters); + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters, Context context); + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostGroupInner update(String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters); + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters, Context context); + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName); + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String hostGroupName, Context context); + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostGroupInner getByResourceGroup(String resourceGroupName, String hostGroupName); + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand, Context context); + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostsClient.java new file mode 100644 index 0000000000000..ff08a384f4455 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DedicatedHostsClient.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.DedicatedHostInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DedicatedHostsClient. */ +public interface DedicatedHostsClient { + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DedicatedHostInner> beginCreateOrUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters); + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DedicatedHostInner> beginCreateOrUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context); + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostInner createOrUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters); + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostInner createOrUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context); + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DedicatedHostInner> beginUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters); + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DedicatedHostInner> beginUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context); + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostInner update( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters); + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostInner update( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context); + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String hostGroupName, String hostname); + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String hostGroupName, String hostname, Context context); + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName, String hostname); + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName, String hostname, Context context); + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DedicatedHostInner get(String resourceGroupName, String hostGroupName, String hostname); + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand, Context context); + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName); + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName, Context context); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String hostGroupName, String hostname); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String hostGroupName, String hostname, Context context); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskAccessesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskAccessesClient.java new file mode 100644 index 0000000000000..ce5cdbfca700e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskAccessesClient.java @@ -0,0 +1,596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.DiskAccessInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.compute.generated.models.DiskAccessUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiskAccessesClient. */ +public interface DiskAccessesClient { + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessInner> beginCreateOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess); + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessInner> beginCreateOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context); + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessInner createOrUpdate(String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess); + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessInner createOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context); + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessInner> beginUpdate( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess); + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessInner> beginUpdate( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context); + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessInner update(String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess); + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessInner update( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context); + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessInner getByResourceGroup(String resourceGroupName, String diskAccessName); + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String diskAccessName, Context context); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String diskAccessName); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String diskAccessName, Context context); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskAccessName); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskAccessName, Context context); + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disk access resources under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the disk access resources under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceListResultInner getPrivateLinkResources(String resourceGroupName, String diskAccessName); + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String diskAccessName, Context context); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner getAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName); + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAPrivateEndpointConnectionWithResponse( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context); + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName); + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskEncryptionSetsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskEncryptionSetsClient.java new file mode 100644 index 0000000000000..710a73e9c12cb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskEncryptionSetsClient.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.DiskEncryptionSetInner; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiskEncryptionSetsClient. */ +public interface DiskEncryptionSetsClient { + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskEncryptionSetInner> beginCreateOrUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet); + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskEncryptionSetInner> beginCreateOrUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context); + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskEncryptionSetInner createOrUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet); + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskEncryptionSetInner createOrUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context); + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskEncryptionSetInner> beginUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet); + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskEncryptionSetInner> beginUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context); + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskEncryptionSetInner update( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet); + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskEncryptionSetInner update( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context); + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskEncryptionSetInner getByResourceGroup(String resourceGroupName, String diskEncryptionSetName); + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String diskEncryptionSetName, Context context); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String diskEncryptionSetName); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String diskEncryptionSetName, Context context); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskEncryptionSetName); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskEncryptionSetName, Context context); + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disk encryption sets under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the disk encryption sets under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAssociatedResources(String resourceGroupName, String diskEncryptionSetName); + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAssociatedResources( + String resourceGroupName, String diskEncryptionSetName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskRestorePointsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskRestorePointsClient.java new file mode 100644 index 0000000000000..b6b80b93a50ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DiskRestorePointsClient.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiskRestorePointsClient. */ +public interface DiskRestorePointsClient { + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskRestorePointInner get( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName); + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context); + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName); + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DisksClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DisksClient.java new file mode 100644 index 0000000000000..e06bc6448a2ec --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/DisksClient.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import com.azure.resourcemanager.compute.generated.models.DiskUpdate; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DisksClient. */ +public interface DisksClient { + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String diskName, DiskInner disk); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String diskName, DiskInner disk, Context context); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk, Context context); + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginUpdate( + String resourceGroupName, String diskName, DiskUpdate disk); + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginUpdate( + String resourceGroupName, String diskName, DiskUpdate disk, Context context); + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk); + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk, Context context); + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner getByResourceGroup(String resourceGroupName, String diskName); + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String diskName); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String diskName, Context context); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 diskName); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 diskName, Context context); + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String diskName); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String diskName, Context context); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String diskName); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String diskName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleriesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleriesClient.java new file mode 100644 index 0000000000000..83f8742d238d9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleriesClient.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.GalleryInner; +import com.azure.resourcemanager.compute.generated.models.GalleryUpdate; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleriesClient. */ +public interface GalleriesClient { + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, GalleryInner gallery); + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context); + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner createOrUpdate(String resourceGroupName, String galleryName, GalleryInner gallery); + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner createOrUpdate(String resourceGroupName, String galleryName, GalleryInner gallery, Context context); + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginUpdate( + String resourceGroupName, String galleryName, GalleryUpdate gallery); + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryInner> beginUpdate( + String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context); + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner update(String resourceGroupName, String galleryName, GalleryUpdate gallery); + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner update(String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context); + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryInner getByResourceGroup(String resourceGroupName, String galleryName); + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String galleryName, SelectPermissions select, Context context); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String galleryName); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String galleryName, Context context); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, Context context); + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List galleries under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List galleries under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationVersionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationVersionsClient.java new file mode 100644 index 0000000000000..0c5743774fcdf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationVersionsClient.java @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.GalleryApplicationVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleryApplicationVersionsClient. */ +public interface GalleryApplicationVersionsClient { + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion); + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context); + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion); + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context); + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion); + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context); + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationVersionInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion); + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationVersionInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context); + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationVersionInner get( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName); + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand, + Context context); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context); + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName); + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationsClient.java new file mode 100644 index 0000000000000..068bd6cc2e635 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryApplicationsClient.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.GalleryApplicationInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleryApplicationsClient. */ +public interface GalleryApplicationsClient { + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication); + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context); + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication); + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context); + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication); + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryApplicationInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context); + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication); + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context); + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryApplicationInner get(String resourceGroupName, String galleryName, String galleryApplicationName); + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryApplicationName); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryApplicationName); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryApplicationName, Context context); + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery(String resourceGroupName, String galleryName); + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery(String resourceGroupName, String galleryName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImageVersionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImageVersionsClient.java new file mode 100644 index 0000000000000..a4a5b6937f295 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImageVersionsClient.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.GalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleryImageVersionsClient. */ +public interface GalleryImageVersionsClient { + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion); + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context); + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion); + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context); + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion); + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context); + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageVersionInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion); + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageVersionInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context); + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageVersionInner get( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand, + Context context); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context); + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName); + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImagesClient.java new file mode 100644 index 0000000000000..2b86a1b6dd1db --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GalleryImagesClient.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.GalleryImageUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleryImagesClient. */ +public interface GalleryImagesClient { + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage); + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context); + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner createOrUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage); + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context); + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage); + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context); + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner update( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage); + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context); + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner get(String resourceGroupName, String galleryName, String galleryImageName); + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String galleryName, String galleryImageName, Context context); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName, Context context); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName, Context context); + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery(String resourceGroupName, String galleryName); + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByGallery(String resourceGroupName, String galleryName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GallerySharingProfilesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GallerySharingProfilesClient.java new file mode 100644 index 0000000000000..49d4367f01d09 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/GallerySharingProfilesClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.SharingUpdateInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GallerySharingProfilesClient. */ +public interface GallerySharingProfilesClient { + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SharingUpdateInner> beginUpdate( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate); + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SharingUpdateInner> beginUpdate( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context); + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharingUpdateInner update(String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate); + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharingUpdateInner update( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ImagesClient.java new file mode 100644 index 0000000000000..1650dc31d151f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ImagesClient.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.ImageInner; +import com.azure.resourcemanager.compute.generated.models.ImageUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImagesClient. */ +public interface ImagesClient { + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String imageName, ImageInner parameters); + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String imageName, ImageInner parameters, Context context); + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner createOrUpdate(String resourceGroupName, String imageName, ImageInner parameters); + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner createOrUpdate(String resourceGroupName, String imageName, ImageInner parameters, Context context); + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginUpdate( + String resourceGroupName, String imageName, ImageUpdate parameters); + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginUpdate( + String resourceGroupName, String imageName, ImageUpdate parameters, Context context); + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner update(String resourceGroupName, String imageName, ImageUpdate parameters); + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner update(String resourceGroupName, String imageName, ImageUpdate parameters, Context context); + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String imageName); + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String imageName, Context context); + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 imageName); + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 imageName, Context context); + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner getByResourceGroup(String resourceGroupName, String imageName); + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String imageName, String expand, Context context); + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/LogAnalyticsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/LogAnalyticsClient.java new file mode 100644 index 0000000000000..413fe578aa12a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/LogAnalyticsClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.LogAnalyticsOperationResultInner; +import com.azure.resourcemanager.compute.generated.models.RequestRateByIntervalInput; +import com.azure.resourcemanager.compute.generated.models.ThrottledRequestsInput; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogAnalyticsClient. */ +public interface LogAnalyticsClient { + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogAnalyticsOperationResultInner> + beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters); + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogAnalyticsOperationResultInner> + beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters, Context context); + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogAnalyticsOperationResultInner exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters); + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogAnalyticsOperationResultInner exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters, Context context); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogAnalyticsOperationResultInner> + beginExportThrottledRequests(String location, ThrottledRequestsInput parameters); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogAnalyticsOperationResultInner> + beginExportThrottledRequests(String location, ThrottledRequestsInput parameters, Context context); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogAnalyticsOperationResultInner exportThrottledRequests(String location, ThrottledRequestsInput parameters); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogAnalyticsOperationResultInner exportThrottledRequests( + String location, ThrottledRequestsInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/OperationsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..e755fc6193581 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Gets a list of compute operations. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ProximityPlacementGroupsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ProximityPlacementGroupsClient.java new file mode 100644 index 0000000000000..ec0518b62d744 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ProximityPlacementGroupsClient.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.ProximityPlacementGroupInner; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupUpdate; + +/** An instance of this class provides access to all the operations defined in ProximityPlacementGroupsClient. */ +public interface ProximityPlacementGroupsClient { + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProximityPlacementGroupInner createOrUpdate( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters); + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupInner parameters, + Context context); + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProximityPlacementGroupInner update( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupUpdate parameters); + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupUpdate parameters, + Context context); + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 proximityPlacementGroupName); + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String proximityPlacementGroupName, Context context); + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProximityPlacementGroupInner getByResourceGroup(String resourceGroupName, String proximityPlacementGroupName); + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context); + + /** + * Lists all proximity placement groups in a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all proximity placement groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ResourceSkusClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ResourceSkusClient.java new file mode 100644 index 0000000000000..41ee728454172 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/ResourceSkusClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; + +/** An instance of this class provides access to all the operations defined in ResourceSkusClient. */ +public interface ResourceSkusClient { + /** + * Gets the list of Microsoft.Compute SKUs available for your 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 the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String includeExtendedLocations, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointCollectionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointCollectionsClient.java new file mode 100644 index 0000000000000..d76744f998909 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointCollectionsClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.RestorePointCollectionInner; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorePointCollectionsClient. */ +public interface RestorePointCollectionsClient { + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointCollectionInner createOrUpdate( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionInner parameters); + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionInner parameters, + Context context); + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointCollectionInner update( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionUpdate parameters); + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionUpdate parameters, + Context context); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String restorePointCollectionName); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, Context context); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, Context context); + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointCollectionInner getByResourceGroup(String resourceGroupName, String restorePointCollectionName); + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionExpandOptions expand, + Context context); + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointsClient.java new file mode 100644 index 0000000000000..18b6eaaa5af51 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/RestorePointsClient.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.generated.models.RestorePointExpandOptions; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorePointsClient. */ +public interface RestorePointsClient { + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters); + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context); + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters); + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context); + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, String restorePointName); + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, String restorePointName, Context context); + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, String restorePointName); + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, String restorePointName, Context context); + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner get(String resourceGroupName, String restorePointCollectionName, String restorePointName); + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleriesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleriesClient.java new file mode 100644 index 0000000000000..aadcb55e06971 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleriesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.SharedGalleryInner; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; + +/** An instance of this class provides access to all the operations defined in SharedGalleriesClient. */ +public interface SharedGalleriesClient { + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location); + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedGalleryInner get(String location, String galleryUniqueName); + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String galleryUniqueName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImageVersionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImageVersionsClient.java new file mode 100644 index 0000000000000..64a256f1221a0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImageVersionsClient.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; + +/** An instance of this class provides access to all the operations defined in SharedGalleryImageVersionsClient. */ +public interface SharedGalleryImageVersionsClient { + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String galleryUniqueName, String galleryImageName); + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedGalleryImageVersionInner get( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName); + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, + String galleryUniqueName, + String galleryImageName, + String galleryImageVersionName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImagesClient.java new file mode 100644 index 0000000000000..4a71867a81e91 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SharedGalleryImagesClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.SharedGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; + +/** An instance of this class provides access to all the operations defined in SharedGalleryImagesClient. */ +public interface SharedGalleryImagesClient { + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, String galleryUniqueName); + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedGalleryImageInner get(String location, String galleryUniqueName, String galleryImageName); + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, String galleryUniqueName, String galleryImageName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SnapshotsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SnapshotsClient.java new file mode 100644 index 0000000000000..963b622c64432 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SnapshotsClient.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.azure.resourcemanager.compute.generated.models.SnapshotUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SnapshotsClient. */ +public interface SnapshotsClient { + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SnapshotInner> beginCreateOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot); + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SnapshotInner> beginCreateOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context); + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot); + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SnapshotInner createOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context); + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SnapshotInner> beginUpdate( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot); + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SnapshotInner> beginUpdate( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context); + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SnapshotInner update(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot); + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SnapshotInner update(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context); + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName); + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String snapshotName, Context context); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String snapshotName); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String snapshotName, Context context); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 snapshotName); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 snapshotName, Context context); + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessUriInner grantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String snapshotName); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, String snapshotName, Context context); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String snapshotName); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String snapshotName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SshPublicKeysClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SshPublicKeysClient.java new file mode 100644 index 0000000000000..24687903dee13 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/SshPublicKeysClient.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyUpdateResource; + +/** An instance of this class provides access to all the operations defined in SshPublicKeysClient. */ +public interface SshPublicKeysClient { + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SshPublicKeyResourceInner create( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters); + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters, Context context); + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SshPublicKeyResourceInner update( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters); + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters, Context context); + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 sshPublicKeyName); + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sshPublicKeyName, Context context); + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SshPublicKeyResourceInner getByResourceGroup(String resourceGroupName, String sshPublicKeyName); + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SshPublicKeyGenerateKeyPairResultInner generateKeyPair(String resourceGroupName, String sshPublicKeyName); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateKeyPairWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/UsagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/UsagesClient.java new file mode 100644 index 0000000000000..d7b99d74d292e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/UsagesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public interface UsagesClient { + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location); + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionImagesClient.java new file mode 100644 index 0000000000000..66d58782ebed6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionImagesClient.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineExtensionImageInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in VirtualMachineExtensionImagesClient. */ +public interface VirtualMachineExtensionImagesClient { + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 extension image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionImageInner get(String location, String publisherName, String type, String version); + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 extension image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, String publisherName, String type, String version, Context context); + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listTypes(String location, String publisherName); + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listTypesWithResponse( + String location, String publisherName, Context context); + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listVersions(String location, String publisherName, String type); + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listVersionsWithResponse( + String location, + String publisherName, + String type, + String filter, + Integer top, + String orderby, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionsClient.java new file mode 100644 index 0000000000000..069ba21643e24 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineExtensionsClient.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineExtensionsClient. */ +public interface VirtualMachineExtensionsClient { + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionInner createOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionInner createOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineExtensionInner> beginUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineExtensionInner> beginUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionInner update( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionInner update( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String vmName, String vmExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String vmExtensionName, Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String vmExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String vmExtensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionInner get(String resourceGroupName, String vmName, String vmExtensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context); + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineExtensionsListResultInner list(String resourceGroupName, String vmName); + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String vmName, String expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesClient.java new file mode 100644 index 0000000000000..7179e65518c82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesClient.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImagesClient. */ +public interface VirtualMachineImagesClient { + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineImageInner get(String location, String publisherName, String offer, String skus, String version); + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, String publisherName, String offer, String skus, String version, Context context); + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String location, String publisherName, String offer, String skus); + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String location, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context); + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listOffers(String location, String publisherName); + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listOffersWithResponse( + String location, String publisherName, Context context); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listPublishers(String location); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listPublishersWithResponse(String location, Context context); + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listSkus(String location, String publisherName, String offer); + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listSkusWithResponse( + String location, String publisherName, String offer, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesEdgeZonesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesEdgeZonesClient.java new file mode 100644 index 0000000000000..c59efc34c7861 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineImagesEdgeZonesClient.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImagesEdgeZonesClient. */ +public interface VirtualMachineImagesEdgeZonesClient { + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image in an edge zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineImageInner get( + String location, String edgeZone, String publisherName, String offer, String skus, String version); + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image in an edge zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String version, + Context context); + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list( + String location, String edgeZone, String publisherName, String offer, String skus); + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context); + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listOffers(String location, String edgeZone, String publisherName); + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listOffersWithResponse( + String location, String edgeZone, String publisherName, Context context); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listPublishers(String location, String edgeZone); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listPublishersWithResponse( + String location, String edgeZone, Context context); + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listSkus( + String location, String edgeZone, String publisherName, String offer); + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listSkusWithResponse( + String location, String edgeZone, String publisherName, String offer, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineRunCommandsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineRunCommandsClient.java new file mode 100644 index 0000000000000..f56dc91eb40b6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineRunCommandsClient.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.RunCommandDocumentBaseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineRunCommandsClient. */ +public interface VirtualMachineRunCommandsClient { + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location); + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, Context context); + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command 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 specific run command for a subscription in a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunCommandDocumentInner get(String location, String commandId); + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command 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 specific run command for a subscription in a location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String commandId, Context context); + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand); + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context); + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand); + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context); + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand); + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context); + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner update( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand); + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String vmName, String runCommandName); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String runCommandName, Context context); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String runCommandName); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String runCommandName, Context context); + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner getByVirtualMachine(String resourceGroupName, String vmName, String runCommandName); + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByVirtualMachineWithResponse( + String resourceGroupName, String vmName, String runCommandName, String expand, Context context); + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachine(String resourceGroupName, String vmName); + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachine( + String resourceGroupName, String vmName, String expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetExtensionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetExtensionsClient.java new file mode 100644 index 0000000000000..0f201cd25abdc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetExtensionsClient.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachineScaleSetExtensionsClient. + */ +public interface VirtualMachineScaleSetExtensionsClient { + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters); + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context); + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters); + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context); + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetExtensionInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters); + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetExtensionInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters); + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String vmssExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String vmssExtensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetExtensionInner get(String resourceGroupName, String vmScaleSetName, String vmssExtensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand, Context context); + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String vmScaleSetName); + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String vmScaleSetName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetRollingUpgradesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetRollingUpgradesClient.java new file mode 100644 index 0000000000000..114a47196df15 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetRollingUpgradesClient.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.RollingUpgradeStatusInfoInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * VirtualMachineScaleSetRollingUpgradesClient. + */ +public interface VirtualMachineScaleSetRollingUpgradesClient { + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancel(String resourceGroupName, String vmScaleSetName); + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancel(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cancel(String resourceGroupName, String vmScaleSetName); + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cancel(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartOSUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartOSUpgrade( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 startOSUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 startOSUpgrade(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartExtensionUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartExtensionUpgrade( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RollingUpgradeStatusInfoInner getLatest(String resourceGroupName, String vmScaleSetName); + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getLatestWithResponse( + String resourceGroupName, String vmScaleSetName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMExtensionsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMExtensionsClient.java new file mode 100644 index 0000000000000..8f05b47b149d0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMExtensionsClient.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachineScaleSetVMExtensionsClient. + */ +public interface VirtualMachineScaleSetVMExtensionsClient { + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters); + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context); + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters); + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context); + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMExtensionInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters); + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMExtensionInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters); + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName); + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, Context context); + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName); + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName, Context context); + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionInner get( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName); + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + String expand, + Context context); + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMExtensionsListResultInner list( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMRunCommandsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMRunCommandsClient.java new file mode 100644 index 0000000000000..f6e1076c02a41 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMRunCommandsClient.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachineScaleSetVMRunCommandsClient. + */ +public interface VirtualMachineScaleSetVMRunCommandsClient { + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand); + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context); + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand); + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, Context context); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName, Context context); + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineRunCommandInner get( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + String expand, + Context context); + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMsClient.java new file mode 100644 index 0000000000000..d57e780b22d0f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetVMsClient.java @@ -0,0 +1,1008 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMReimageParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineScaleSetVMsClient. */ +public interface VirtualMachineScaleSetVMsClient { + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMInner update( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion, Context context); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion, Context context); + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 from a VM scale set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMInner get(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 from a VM scale set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context); + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetVMInstanceViewInner getInstanceView( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String virtualMachineScaleSetName); + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetrieveBootDiagnosticsDataResultInner retrieveBootDiagnosticsData( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + Integer sasUriExpirationTimeInMinutes, + Context context); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 simulateEviction(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response simulateEvictionWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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) + RunCommandResultInner runCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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) + RunCommandResultInner runCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetsClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetsClient.java new file mode 100644 index 0000000000000..2a21374667f4e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineScaleSetsClient.java @@ -0,0 +1,1482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.RecoveryWalkResponseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetVMScaleSets; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineScaleSetsClient. */ +public interface VirtualMachineScaleSetsClient { + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetInner> beginCreateOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters); + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetInner> beginCreateOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context); + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInner createOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters); + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInner createOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context); + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters); + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineScaleSetInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context); + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInner update( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters); + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInner update( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, Boolean forceDeletion); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, Boolean forceDeletion, Context context); + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInner getByResourceGroup(String resourceGroupName, String vmScaleSetName); + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context); + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineScaleSetInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName); + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkus(String resourceGroupName, String vmScaleSetName); + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkus( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName); + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance(String resourceGroupName, String vmScaleSetName); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpdateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpdateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 updateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 updateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String vmScaleSetName); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoveryWalkResponseInner forceRecoveryServiceFabricPlatformUpdateDomainWalk( + String resourceGroupName, String vmScaleSetName, int platformUpdateDomain); + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId, + Context context); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 convertToSinglePlacementGroup( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response convertToSinglePlacementGroupWithResponse( + String resourceGroupName, + String vmScaleSetName, + VMScaleSetConvertToSinglePlacementGroupInput parameters, + Context context); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSetOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSetOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineSizesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineSizesClient.java new file mode 100644 index 0000000000000..0870752015bf0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachineSizesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; + +/** An instance of this class provides access to all the operations defined in VirtualMachineSizesClient. */ +public interface VirtualMachineSizesClient { + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location); + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachinesClient.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachinesClient.java new file mode 100644 index 0000000000000..49fd81ea6cf6d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/VirtualMachinesClient.java @@ -0,0 +1,1372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachinesClient. */ +public interface VirtualMachinesClient { + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineCaptureResultInner> beginCapture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineCaptureResultInner> beginCapture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineCaptureResultInner capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineCaptureResultInner capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner parameters); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context); + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters); + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context); + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters); + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String vmName, Boolean forceDeletion); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, Boolean forceDeletion, Context context); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, Boolean forceDeletion); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, Boolean forceDeletion, Context context); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String vmName, InstanceViewTypes expand, Context context); + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceViewInner instanceView(String resourceGroupName, String vmName); + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response instanceViewWithResponse( + String resourceGroupName, String vmName, Context context); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginConvertToManagedDisks(String resourceGroupName, String vmName); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginConvertToManagedDisks( + String resourceGroupName, String vmName, Context context); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 convertToManagedDisks(String resourceGroupName, String vmName); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 convertToManagedDisks(String resourceGroupName, String vmName, Context context); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate(String resourceGroupName, String vmName, Boolean hibernate); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmName, Boolean hibernate, Context context); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmName, Boolean hibernate); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmName); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 deallocate(String resourceGroupName, String vmName, Boolean hibernate, Context context); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 generalize(String resourceGroupName, String vmName); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generalizeWithResponse(String resourceGroupName, String vmName, Context context); + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String statusOnly, String filter, Context context); + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAvailableSizes(String resourceGroupName, String vmName); + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAvailableSizes(String resourceGroupName, String vmName, Context context); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff(String resourceGroupName, String vmName, Boolean skipShutdown); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmName, Boolean skipShutdown, Context context); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmName, Boolean skipShutdown); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmName); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 powerOff(String resourceGroupName, String vmName, Boolean skipShutdown, Context context); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReapply(String resourceGroupName, String vmName); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReapply(String resourceGroupName, String vmName, Context context); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reapply(String resourceGroupName, String vmName); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reapply(String resourceGroupName, String vmName, Context context); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String vmName); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String vmName, Context context); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName, Context context); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String vmName); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String vmName, Context context); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName, Context context); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmName); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmName, Context context); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmName); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 redeploy(String resourceGroupName, String vmName, Context context); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String vmName); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetrieveBootDiagnosticsDataResultInner retrieveBootDiagnosticsData(String resourceGroupName, String vmName); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes, Context context); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance(String resourceGroupName, String vmName); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmName, Context context); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance(String resourceGroupName, String vmName); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 performMaintenance(String resourceGroupName, String vmName, Context context); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 simulateEviction(String resourceGroupName, String vmName); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response simulateEvictionWithResponse(String resourceGroupName, String vmName, Context context); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineAssessPatchesResultInner> + beginAssessPatches(String resourceGroupName, String vmName); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineAssessPatchesResultInner> + beginAssessPatches(String resourceGroupName, String vmName, Context context); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineAssessPatchesResultInner assessPatches(String resourceGroupName, String vmName); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineAssessPatchesResultInner assessPatches(String resourceGroupName, String vmName, Context context); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstallPatchesResultInner> + beginInstallPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstallPatchesResultInner> + beginInstallPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstallPatchesResultInner installPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstallPatchesResultInner installPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmName, RunCommandInput parameters); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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.LONG_RUNNING_OPERATION) + SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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) + RunCommandResultInner runCommand(String resourceGroupName, String vmName, RunCommandInput parameters); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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) + RunCommandResultInner runCommand( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AccessUriInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AccessUriInner.java new file mode 100644 index 0000000000000..d342e28e158eb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AccessUriInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A disk access SAS uri. */ +@Immutable +public final class AccessUriInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccessUriInner.class); + + /* + * A SAS uri for accessing a disk. + */ + @JsonProperty(value = "accessSAS", access = JsonProperty.Access.WRITE_ONLY) + private String accessSas; + + /* + * A SAS uri for accessing a VM guest state. + */ + @JsonProperty(value = "securityDataAccessSAS", access = JsonProperty.Access.WRITE_ONLY) + private String securityDataAccessSas; + + /** + * Get the accessSas property: A SAS uri for accessing a disk. + * + * @return the accessSas value. + */ + public String accessSas() { + return this.accessSas; + } + + /** + * Get the securityDataAccessSas property: A SAS uri for accessing a VM guest state. + * + * @return the securityDataAccessSas value. + */ + public String securityDataAccessSas() { + return this.securityDataAccessSas; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetInner.java new file mode 100644 index 0000000000000..ad18e53c7afb1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetInner.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines + * specified in the same availability set are allocated to different nodes to maximize availability. For more + * information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For more + * information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, a + * VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. + */ +@Fluent +public final class AvailabilitySetInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilitySetInner.class); + + /* + * The instance view of a resource. + */ + @JsonProperty(value = "properties") + private AvailabilitySetProperties innerProperties; + + /* + * Sku of the availability set, only name is required to be set. See + * AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for + * virtual machines with managed disks and 'Classic' for virtual machines + * with unmanaged disks. Default value is 'Classic'. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the innerProperties property: The instance view of a resource. + * + * @return the innerProperties value. + */ + private AvailabilitySetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes + * for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual + * machines with unmanaged disks. Default value is 'Classic'. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes + * for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual + * machines with unmanaged disks. Default value is 'Classic'. + * + * @param sku the sku value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public AvailabilitySetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AvailabilitySetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformUpdateDomainCount property: Update Domain count. + * + * @return the platformUpdateDomainCount value. + */ + public Integer platformUpdateDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformUpdateDomainCount(); + } + + /** + * Set the platformUpdateDomainCount property: Update Domain count. + * + * @param platformUpdateDomainCount the platformUpdateDomainCount value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withPlatformUpdateDomainCount(platformUpdateDomainCount); + return this; + } + + /** + * Get the platformFaultDomainCount property: Fault Domain count. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomainCount(); + } + + /** + * Set the platformFaultDomainCount property: Fault Domain count. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachines(); + } + + /** + * Set the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @param virtualMachines the virtualMachines value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withVirtualMachines(List virtualMachines) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withVirtualMachines(virtualMachines); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetProperties.java new file mode 100644 index 0000000000000..024a71c826623 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/AvailabilitySetProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a resource. */ +@Fluent +public final class AvailabilitySetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilitySetProperties.class); + + /* + * Update Domain count. + */ + @JsonProperty(value = "platformUpdateDomainCount") + private Integer platformUpdateDomainCount; + + /* + * Fault Domain count. + */ + @JsonProperty(value = "platformFaultDomainCount") + private Integer platformFaultDomainCount; + + /* + * A list of references to all virtual machines in the availability set. + */ + @JsonProperty(value = "virtualMachines") + private List virtualMachines; + + /* + * Specifies information about the proximity placement group that the + * availability set should be assigned to.

Minimum api-version: + * 2018-04-01. + */ + @JsonProperty(value = "proximityPlacementGroup") + private SubResource proximityPlacementGroup; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /** + * Get the platformUpdateDomainCount property: Update Domain count. + * + * @return the platformUpdateDomainCount value. + */ + public Integer platformUpdateDomainCount() { + return this.platformUpdateDomainCount; + } + + /** + * Set the platformUpdateDomainCount property: Update Domain count. + * + * @param platformUpdateDomainCount the platformUpdateDomainCount value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) { + this.platformUpdateDomainCount = platformUpdateDomainCount; + return this; + } + + /** + * Get the platformFaultDomainCount property: Fault Domain count. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.platformFaultDomainCount; + } + + /** + * Set the platformFaultDomainCount property: Fault Domain count. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + this.platformFaultDomainCount = platformFaultDomainCount; + return this; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Set the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @param virtualMachines the virtualMachines value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withVirtualMachines(List virtualMachines) { + this.virtualMachines = virtualMachines; + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.proximityPlacementGroup; + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withProximityPlacementGroup(SubResource proximityPlacementGroup) { + this.proximityPlacementGroup = proximityPlacementGroup; + return this; + } + + /** + * 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()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupInner.java new file mode 100644 index 0000000000000..a8ca24147d7b2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Specifies information about the capacity reservation group that the capacity reservations should be assigned to. + * <br><br> Currently, a capacity reservation can only be added to a capacity reservation group at creation + * time. An existing capacity reservation cannot be added or moved to another capacity reservation group. + */ +@Fluent +public final class CapacityReservationGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupInner.class); + + /* + * capacity reservation group Properties. + */ + @JsonProperty(value = "properties") + private CapacityReservationGroupProperties innerProperties; + + /* + * Availability Zones to use for this capacity reservation group. The zones + * can be assigned only during creation. If not provided, the group + * supports only regional resources in the region. If provided, enforces + * each capacity reservation in the group to be in one of the zones. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the innerProperties property: capacity reservation group Properties. + * + * @return the innerProperties value. + */ + private CapacityReservationGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the zones property: Availability Zones to use for this capacity reservation group. The zones can be assigned + * only during creation. If not provided, the group supports only regional resources in the region. If provided, + * enforces each capacity reservation in the group to be in one of the zones. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Availability Zones to use for this capacity reservation group. The zones can be assigned + * only during creation. If not provided, the group supports only regional resources in the region. If provided, + * enforces each capacity reservation in the group to be in one of the zones. + * + * @param zones the zones value to set. + * @return the CapacityReservationGroupInner object itself. + */ + public CapacityReservationGroupInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the capacityReservations property: A list of all capacity reservation resource ids that belong to capacity + * reservation group. + * + * @return the capacityReservations value. + */ + public List capacityReservations() { + return this.innerProperties() == null ? null : this.innerProperties().capacityReservations(); + } + + /** + * Get the virtualMachinesAssociated property: A list of references to all virtual machines associated to the + * capacity reservation group. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachinesAssociated(); + } + + /** + * Get the instanceView property: The capacity reservation group instance view which has the list of instance views + * for all the capacity reservations that belong to the capacity reservation group. + * + * @return the instanceView value. + */ + public CapacityReservationGroupInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupProperties.java new file mode 100644 index 0000000000000..7d6426e09f32e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationGroupProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** capacity reservation group Properties. */ +@Immutable +public final class CapacityReservationGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupProperties.class); + + /* + * A list of all capacity reservation resource ids that belong to capacity + * reservation group. + */ + @JsonProperty(value = "capacityReservations", access = JsonProperty.Access.WRITE_ONLY) + private List capacityReservations; + + /* + * A list of references to all virtual machines associated to the capacity + * reservation group. + */ + @JsonProperty(value = "virtualMachinesAssociated", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachinesAssociated; + + /* + * The capacity reservation group instance view which has the list of + * instance views for all the capacity reservations that belong to the + * capacity reservation group. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private CapacityReservationGroupInstanceView instanceView; + + /** + * Get the capacityReservations property: A list of all capacity reservation resource ids that belong to capacity + * reservation group. + * + * @return the capacityReservations value. + */ + public List capacityReservations() { + return this.capacityReservations; + } + + /** + * Get the virtualMachinesAssociated property: A list of references to all virtual machines associated to the + * capacity reservation group. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.virtualMachinesAssociated; + } + + /** + * Get the instanceView property: The capacity reservation group instance view which has the list of instance views + * for all the capacity reservations that belong to the capacity reservation group. + * + * @return the instanceView value. + */ + public CapacityReservationGroupInstanceView instanceView() { + return this.instanceView; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capacityReservations() != null) { + capacityReservations().forEach(e -> e.validate()); + } + if (virtualMachinesAssociated() != null) { + virtualMachinesAssociated().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationInner.java new file mode 100644 index 0000000000000..55b9dd40a12ca --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationInner.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceView; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the capacity reservation. */ +@Fluent +public final class CapacityReservationInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationInner.class); + + /* + * Properties of the Capacity reservation. + */ + @JsonProperty(value = "properties") + private CapacityReservationProperties innerProperties; + + /* + * SKU of the resource for which capacity needs be reserved. The SKU name + * and capacity is required to be set. Currently VM Skus with the + * capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + * supported values. + */ + @JsonProperty(value = "sku", required = true) + private Sku sku; + + /* + * Availability Zone to use for this capacity reservation. The zone has to + * be single value and also should be part for the list of zones specified + * during the capacity reservation group creation. The zone can be assigned + * only during creation. If not provided, the reservation supports only + * non-zonal deployments. If provided, enforces VM/VMSS using this capacity + * reservation to be in same zone. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the innerProperties property: Properties of the Capacity reservation. + * + * @return the innerProperties value. + */ + private CapacityReservationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * + * @param sku the sku value to set. + * @return the CapacityReservationInner object itself. + */ + public CapacityReservationInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the zones property: Availability Zone to use for this capacity reservation. The zone has to be single value + * and also should be part for the list of zones specified during the capacity reservation group creation. The zone + * can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If + * provided, enforces VM/VMSS using this capacity reservation to be in same zone. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Availability Zone to use for this capacity reservation. The zone has to be single value + * and also should be part for the list of zones specified during the capacity reservation group creation. The zone + * can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If + * provided, enforces VM/VMSS using this capacity reservation to be in same zone. + * + * @param zones the zones value to set. + * @return the CapacityReservationInner object itself. + */ + public CapacityReservationInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the reservationId property: A unique id generated and assigned to the capacity reservation by the platform + * which does not change throughout the lifetime of the resource. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.innerProperties() == null ? null : this.innerProperties().reservationId(); + } + + /** + * Get the virtualMachinesAssociated property: A list of all virtual machine resource ids that are associated with + * the capacity reservation. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachinesAssociated(); + } + + /** + * Get the provisioningTime property: The date time when the capacity reservation was last updated. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningTime(); + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The Capacity reservation instance view. + * + * @return the instanceView value. + */ + public CapacityReservationInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the timeCreated property: Specifies the time at which the Capacity Reservation resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model CapacityReservationInner")); + } else { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationProperties.java new file mode 100644 index 0000000000000..9b974c9493083 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CapacityReservationProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceView; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the Capacity reservation. */ +@Immutable +public final class CapacityReservationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationProperties.class); + + /* + * A unique id generated and assigned to the capacity reservation by the + * platform which does not change throughout the lifetime of the resource. + */ + @JsonProperty(value = "reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /* + * A list of all virtual machine resource ids that are associated with the + * capacity reservation. + */ + @JsonProperty(value = "virtualMachinesAssociated", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachinesAssociated; + + /* + * The date time when the capacity reservation was last updated. + */ + @JsonProperty(value = "provisioningTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime provisioningTime; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The Capacity reservation instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private CapacityReservationInstanceView instanceView; + + /* + * Specifies the time at which the Capacity Reservation resource was + * created.

Minimum api-version: 2021-11-01. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /** + * Get the reservationId property: A unique id generated and assigned to the capacity reservation by the platform + * which does not change throughout the lifetime of the resource. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get the virtualMachinesAssociated property: A list of all virtual machine resource ids that are associated with + * the capacity reservation. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.virtualMachinesAssociated; + } + + /** + * Get the provisioningTime property: The date time when the capacity reservation was last updated. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.provisioningTime; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The Capacity reservation instance view. + * + * @return the instanceView value. + */ + public CapacityReservationInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the timeCreated property: Specifies the time at which the Capacity Reservation resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachinesAssociated() != null) { + virtualMachinesAssociated().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInner.java new file mode 100644 index 0000000000000..adf7292ad30ae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CloudServiceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes the cloud service. */ +@Fluent +public final class CloudServiceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceInner.class); + + /* + * Cloud service properties + */ + @JsonProperty(value = "properties") + private CloudServiceProperties properties; + + /** + * Get the properties property: Cloud service properties. + * + * @return the properties value. + */ + public CloudServiceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Cloud service properties. + * + * @param properties the properties value to set. + * @return the CloudServiceInner object itself. + */ + public CloudServiceInner withProperties(CloudServiceProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudServiceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudServiceInner 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(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInstanceViewInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInstanceViewInner.java new file mode 100644 index 0000000000000..9c82cbef94eb5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceInstanceViewInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatusesSummary; +import com.azure.resourcemanager.compute.generated.models.ResourceInstanceViewStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** InstanceView of CloudService as a whole. */ +@Fluent +public final class CloudServiceInstanceViewInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceInstanceViewInner.class); + + /* + * Instance view statuses. + */ + @JsonProperty(value = "roleInstance") + private InstanceViewStatusesSummary roleInstance; + + /* + * The version of the SDK that was used to generate the package for the + * cloud service. + */ + @JsonProperty(value = "sdkVersion", access = JsonProperty.Access.WRITE_ONLY) + private String sdkVersion; + + /* + * Specifies a list of unique identifiers generated internally for the + * cloud service.

NOTE: If you are using Azure Diagnostics + * extension, this property can be used as 'DeploymentId' for querying + * details. + */ + @JsonProperty(value = "privateIds", access = JsonProperty.Access.WRITE_ONLY) + private List privateIds; + + /* + * The statuses property. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /** + * Get the roleInstance property: Instance view statuses. + * + * @return the roleInstance value. + */ + public InstanceViewStatusesSummary roleInstance() { + return this.roleInstance; + } + + /** + * Set the roleInstance property: Instance view statuses. + * + * @param roleInstance the roleInstance value to set. + * @return the CloudServiceInstanceViewInner object itself. + */ + public CloudServiceInstanceViewInner withRoleInstance(InstanceViewStatusesSummary roleInstance) { + this.roleInstance = roleInstance; + return this; + } + + /** + * Get the sdkVersion property: The version of the SDK that was used to generate the package for the cloud service. + * + * @return the sdkVersion value. + */ + public String sdkVersion() { + return this.sdkVersion; + } + + /** + * Get the privateIds property: Specifies a list of unique identifiers generated internally for the cloud service. + * <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as + * 'DeploymentId' for querying details. + * + * @return the privateIds value. + */ + public List privateIds() { + return this.privateIds; + } + + /** + * Get the statuses property: The statuses property. + * + * @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 (roleInstance() != null) { + roleInstance().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceRoleInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceRoleInner.java new file mode 100644 index 0000000000000..cb17fddcaa60d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CloudServiceRoleInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a role of the cloud service. */ +@Fluent +public final class CloudServiceRoleInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleInner.class); + + /* + * Resource id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Resource location + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Describes the cloud service role sku. + */ + @JsonProperty(value = "sku") + private CloudServiceRoleSku sku; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private CloudServiceRoleProperties properties; + + /** + * Get the id property: Resource id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the sku property: Describes the cloud service role sku. + * + * @return the sku value. + */ + public CloudServiceRoleSku sku() { + return this.sku; + } + + /** + * Set the sku property: Describes the cloud service role sku. + * + * @param sku the sku value to set. + * @return the CloudServiceRoleInner object itself. + */ + public CloudServiceRoleInner withSku(CloudServiceRoleSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public CloudServiceRoleProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the CloudServiceRoleInner object itself. + */ + public CloudServiceRoleInner withProperties(CloudServiceRoleProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryIdentifier.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryIdentifier.java new file mode 100644 index 0000000000000..eace0c30e4699 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryIdentifier.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The identifier information of community gallery. */ +@Fluent +public final class CommunityGalleryIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryIdentifier.class); + + /* + * The unique id of this community gallery. + */ + @JsonProperty(value = "uniqueId") + private String uniqueId; + + /** + * Get the uniqueId property: The unique id of this community gallery. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Set the uniqueId property: The unique id of this community gallery. + * + * @param uniqueId the uniqueId value to set. + * @return the CommunityGalleryIdentifier object itself. + */ + public CommunityGalleryIdentifier withUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageInner.java new file mode 100644 index 0000000000000..7b425d7db1740 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageInner.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PirCommunityGalleryResource; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Specifies information about the gallery image definition that you want to create or update. */ +@Fluent +public final class CommunityGalleryImageInner extends PirCommunityGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImageInner.class); + + /* + * Describes the properties of a gallery image definition. + */ + @JsonProperty(value = "properties") + private CommunityGalleryImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image definition. + * + * @return the innerProperties value. + */ + private CommunityGalleryImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CommunityGalleryImageInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.innerProperties() == null ? null : this.innerProperties().osState(); + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withOsState(OperatingSystemStateTypes osState) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withOsState(osState); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withIdentifier(GalleryImageIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.innerProperties() == null ? null : this.innerProperties().recommended(); + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withRecommended(RecommendedMachineConfiguration recommended) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withRecommended(recommended); + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.innerProperties() == null ? null : this.innerProperties().disallowed(); + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withDisallowed(Disallowed disallowed) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withDisallowed(disallowed); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.innerProperties() == null ? null : this.innerProperties().features(); + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withFeatures(List features) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withFeatures(features); + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the CommunityGalleryImageInner object itself. + */ + public CommunityGalleryImageInner withPurchasePlan(ImagePurchasePlan purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageProperties.java new file mode 100644 index 0000000000000..7ec9eec773218 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageProperties.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the properties of a gallery image definition. */ +@Fluent +public final class CommunityGalleryImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImageProperties.class); + + /* + * This property allows you to specify the type of the OS that is included + * in the disk when creating a VM from a managed image.

Possible + * values are:

**Windows**

**Linux** + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemTypes osType; + + /* + * This property allows the user to specify whether the virtual machines + * created under this image are 'Generalized' or 'Specialized'. + */ + @JsonProperty(value = "osState", required = true) + private OperatingSystemStateTypes osState; + + /* + * The end of life date of the gallery image definition. This property can + * be used for decommissioning purposes. This property is updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /* + * This is the gallery image definition identifier. + */ + @JsonProperty(value = "identifier", required = true) + private GalleryImageIdentifier identifier; + + /* + * The properties describe the recommended machine configuration for this + * Image Definition. These properties are updatable. + */ + @JsonProperty(value = "recommended") + private RecommendedMachineConfiguration recommended; + + /* + * Describes the disallowed disk types. + */ + @JsonProperty(value = "disallowed") + private Disallowed disallowed; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * A list of gallery image features. + */ + @JsonProperty(value = "features") + private List features; + + /* + * Describes the gallery image definition purchase plan. This is used by + * marketplace images. + */ + @JsonProperty(value = "purchasePlan") + private ImagePurchasePlan purchasePlan; + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **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 when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.osState; + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withOsState(OperatingSystemStateTypes osState) { + this.osState = osState; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + 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 CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withIdentifier(GalleryImageIdentifier identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.recommended; + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withRecommended(RecommendedMachineConfiguration recommended) { + this.recommended = recommended; + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.disallowed; + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withDisallowed(Disallowed disallowed) { + this.disallowed = disallowed; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.features; + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the CommunityGalleryImageProperties object itself. + */ + public CommunityGalleryImageProperties withPurchasePlan(ImagePurchasePlan purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osType in model CommunityGalleryImageProperties")); + } + if (osState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osState in model CommunityGalleryImageProperties")); + } + if (identifier() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property identifier in model CommunityGalleryImageProperties")); + } else { + identifier().validate(); + } + if (recommended() != null) { + recommended().validate(); + } + if (disallowed() != null) { + disallowed().validate(); + } + if (features() != null) { + features().forEach(e -> e.validate()); + } + if (purchasePlan() != null) { + purchasePlan().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionInner.java new file mode 100644 index 0000000000000..094317ca8521d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PirCommunityGalleryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Specifies information about the gallery image version that you want to create or update. */ +@Fluent +public final class CommunityGalleryImageVersionInner extends PirCommunityGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImageVersionInner.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private CommunityGalleryImageVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private CommunityGalleryImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CommunityGalleryImageVersionInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Get the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.innerProperties() == null ? null : this.innerProperties().publishedDate(); + } + + /** + * Set the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param publishedDate the publishedDate value to set. + * @return the CommunityGalleryImageVersionInner object itself. + */ + public CommunityGalleryImageVersionInner withPublishedDate(OffsetDateTime publishedDate) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageVersionProperties(); + } + this.innerProperties().withPublishedDate(publishedDate); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the CommunityGalleryImageVersionInner object itself. + */ + public CommunityGalleryImageVersionInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityGalleryImageVersionProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionProperties.java new file mode 100644 index 0000000000000..e69fd16f5441c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryImageVersionProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of a gallery image version. */ +@Fluent +public final class CommunityGalleryImageVersionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImageVersionProperties.class); + + /* + * The published date of the gallery image version Definition. This + * property can be used for decommissioning purposes. This property is + * updatable. + */ + @JsonProperty(value = "publishedDate") + private OffsetDateTime publishedDate; + + /* + * The end of life date of the gallery image version Definition. This + * property can be used for decommissioning purposes. This property is + * updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /** + * Get the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.publishedDate; + } + + /** + * Set the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param publishedDate the publishedDate value to set. + * @return the CommunityGalleryImageVersionProperties object itself. + */ + public CommunityGalleryImageVersionProperties withPublishedDate(OffsetDateTime publishedDate) { + this.publishedDate = publishedDate; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the CommunityGalleryImageVersionProperties object itself. + */ + public CommunityGalleryImageVersionProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryInner.java new file mode 100644 index 0000000000000..b1ab18eb85a07 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/CommunityGalleryInner.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PirCommunityGalleryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Specifies information about the Community Gallery that you want to create or update. */ +@Fluent +public final class CommunityGalleryInner extends PirCommunityGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryInner.class); + + /** {@inheritDoc} */ + @Override + public CommunityGalleryInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueDisplay.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueDisplay.java new file mode 100644 index 0000000000000..3cb3f96513bc7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Compute Operation Value Display. */ +@Immutable +public final class ComputeOperationValueDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeOperationValueDisplay.class); + + /* + * The display name of the compute operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueInner.java new file mode 100644 index 0000000000000..d24f89676d554 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ComputeOperationValueInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Compute Operation value. */ +@Fluent +public final class ComputeOperationValueInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeOperationValueInner.class); + + /* + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Describes the properties of a Compute Operation Value Display. + */ + @JsonProperty(value = "display") + private ComputeOperationValueDisplay innerDisplay; + + /** + * Get the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the name property: The name of the compute operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerDisplay property: Describes the properties of a Compute Operation Value Display. + * + * @return the innerDisplay value. + */ + private ComputeOperationValueDisplay innerDisplay() { + return this.innerDisplay; + } + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerDisplay() == null ? null : this.innerDisplay().operation(); + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.innerDisplay() == null ? null : this.innerDisplay().resource(); + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.innerDisplay() == null ? null : this.innerDisplay().description(); + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.innerDisplay() == null ? null : this.innerDisplay().provider(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerDisplay() != null) { + innerDisplay().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupInner.java new file mode 100644 index 0000000000000..45a5852f70cc1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupInner.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Specifies information about the dedicated host group that the dedicated hosts should be assigned to. + * <br><br> Currently, a dedicated host can only be added to a dedicated host group at creation time. An + * existing dedicated host cannot be added to another dedicated host group. + */ +@Fluent +public final class DedicatedHostGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupInner.class); + + /* + * Dedicated Host Group Properties. + */ + @JsonProperty(value = "properties") + private DedicatedHostGroupProperties innerProperties; + + /* + * Availability Zone to use for this host group. Only single zone is + * supported. The zone can be assigned only during creation. If not + * provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the innerProperties property: Dedicated Host Group Properties. + * + * @return the innerProperties value. + */ + private DedicatedHostGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the zones property: Availability Zone to use for this host group. Only single zone is supported. The zone can + * be assigned only during creation. If not provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Availability Zone to use for this host group. Only single zone is supported. The zone can + * be assigned only during creation. If not provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + * + * @param zones the zones value to set. + * @return the DedicatedHostGroupInner object itself. + */ + public DedicatedHostGroupInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomainCount(); + } + + /** + * Set the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the DedicatedHostGroupInner object itself. + */ + public DedicatedHostGroupInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostGroupProperties(); + } + this.innerProperties().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + /** + * Get the hosts property: A list of references to all dedicated hosts in the dedicated host group. + * + * @return the hosts value. + */ + public List hosts() { + return this.innerProperties() == null ? null : this.innerProperties().hosts(); + } + + /** + * Get the instanceView property: The dedicated host group instance view, which has the list of instance view of the + * dedicated hosts under the dedicated host group. + * + * @return the instanceView value. + */ + public DedicatedHostGroupInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @return the supportAutomaticPlacement value. + */ + public Boolean supportAutomaticPlacement() { + return this.innerProperties() == null ? null : this.innerProperties().supportAutomaticPlacement(); + } + + /** + * Set the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @param supportAutomaticPlacement the supportAutomaticPlacement value to set. + * @return the DedicatedHostGroupInner object itself. + */ + public DedicatedHostGroupInner withSupportAutomaticPlacement(Boolean supportAutomaticPlacement) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostGroupProperties(); + } + this.innerProperties().withSupportAutomaticPlacement(supportAutomaticPlacement); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupProperties.java new file mode 100644 index 0000000000000..ad01316aae159 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostGroupProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Dedicated Host Group Properties. */ +@Fluent +public final class DedicatedHostGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupProperties.class); + + /* + * Number of fault domains that the host group can span. + */ + @JsonProperty(value = "platformFaultDomainCount", required = true) + private int platformFaultDomainCount; + + /* + * A list of references to all dedicated hosts in the dedicated host group. + */ + @JsonProperty(value = "hosts", access = JsonProperty.Access.WRITE_ONLY) + private List hosts; + + /* + * The dedicated host group instance view, which has the list of instance + * view of the dedicated hosts under the dedicated host group. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private DedicatedHostGroupInstanceView instanceView; + + /* + * Specifies whether virtual machines or virtual machine scale sets can be + * placed automatically on the dedicated host group. Automatic placement + * means resources are allocated on dedicated hosts, that are chosen by + * Azure, under the dedicated host group. The value is defaulted to 'false' + * when not provided.

Minimum api-version: 2020-06-01. + */ + @JsonProperty(value = "supportAutomaticPlacement") + private Boolean supportAutomaticPlacement; + + /** + * Get the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @return the platformFaultDomainCount value. + */ + public int platformFaultDomainCount() { + return this.platformFaultDomainCount; + } + + /** + * Set the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the DedicatedHostGroupProperties object itself. + */ + public DedicatedHostGroupProperties withPlatformFaultDomainCount(int platformFaultDomainCount) { + this.platformFaultDomainCount = platformFaultDomainCount; + return this; + } + + /** + * Get the hosts property: A list of references to all dedicated hosts in the dedicated host group. + * + * @return the hosts value. + */ + public List hosts() { + return this.hosts; + } + + /** + * Get the instanceView property: The dedicated host group instance view, which has the list of instance view of the + * dedicated hosts under the dedicated host group. + * + * @return the instanceView value. + */ + public DedicatedHostGroupInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @return the supportAutomaticPlacement value. + */ + public Boolean supportAutomaticPlacement() { + return this.supportAutomaticPlacement; + } + + /** + * Set the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @param supportAutomaticPlacement the supportAutomaticPlacement value to set. + * @return the DedicatedHostGroupProperties object itself. + */ + public DedicatedHostGroupProperties withSupportAutomaticPlacement(Boolean supportAutomaticPlacement) { + this.supportAutomaticPlacement = supportAutomaticPlacement; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hosts() != null) { + hosts().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostInner.java new file mode 100644 index 0000000000000..2187c045e065c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostInner.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostInstanceView; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostLicenseTypes; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the Dedicated host. */ +@Fluent +public final class DedicatedHostInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostInner.class); + + /* + * Properties of the dedicated host. + */ + @JsonProperty(value = "properties") + private DedicatedHostProperties innerProperties; + + /* + * SKU of the dedicated host for Hardware Generation and VM family. Only + * name is required to be set. List Microsoft.Compute SKUs for a list of + * possible values. + */ + @JsonProperty(value = "sku", required = true) + private Sku sku; + + /** + * Get the innerProperties property: Properties of the dedicated host. + * + * @return the innerProperties value. + */ + private DedicatedHostProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: SKU of the dedicated host for Hardware Generation and VM family. Only name is required to + * be set. List Microsoft.Compute SKUs for a list of possible values. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the dedicated host for Hardware Generation and VM family. Only name is required to + * be set. List Microsoft.Compute SKUs for a list of possible values. + * + * @param sku the sku value to set. + * @return the DedicatedHostInner object itself. + */ + public DedicatedHostInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomain(); + } + + /** + * Set the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the DedicatedHostInner object itself. + */ + public DedicatedHostInner withPlatformFaultDomain(Integer platformFaultDomain) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withPlatformFaultDomain(platformFaultDomain); + return this; + } + + /** + * Get the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @return the autoReplaceOnFailure value. + */ + public Boolean autoReplaceOnFailure() { + return this.innerProperties() == null ? null : this.innerProperties().autoReplaceOnFailure(); + } + + /** + * Set the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @param autoReplaceOnFailure the autoReplaceOnFailure value to set. + * @return the DedicatedHostInner object itself. + */ + public DedicatedHostInner withAutoReplaceOnFailure(Boolean autoReplaceOnFailure) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withAutoReplaceOnFailure(autoReplaceOnFailure); + return this; + } + + /** + * Get the hostId property: A unique id generated and assigned to the dedicated host by the platform. + * <br><br> Does not change throughout the lifetime of the host. + * + * @return the hostId value. + */ + public String hostId() { + return this.innerProperties() == null ? null : this.innerProperties().hostId(); + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the Dedicated Host. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachines(); + } + + /** + * Get the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @return the licenseType value. + */ + public DedicatedHostLicenseTypes licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @param licenseType the licenseType value to set. + * @return the DedicatedHostInner object itself. + */ + public DedicatedHostInner withLicenseType(DedicatedHostLicenseTypes licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the provisioningTime property: The date when the host was first provisioned. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningTime(); + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The dedicated host instance view. + * + * @return the instanceView value. + */ + public DedicatedHostInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the timeCreated property: Specifies the time at which the Dedicated Host resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model DedicatedHostInner")); + } else { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostProperties.java new file mode 100644 index 0000000000000..81d3acbb04ef9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DedicatedHostProperties.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostInstanceView; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostLicenseTypes; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the dedicated host. */ +@Fluent +public final class DedicatedHostProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostProperties.class); + + /* + * Fault domain of the dedicated host within a dedicated host group. + */ + @JsonProperty(value = "platformFaultDomain") + private Integer platformFaultDomain; + + /* + * Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + */ + @JsonProperty(value = "autoReplaceOnFailure") + private Boolean autoReplaceOnFailure; + + /* + * A unique id generated and assigned to the dedicated host by the + * platform.

Does not change throughout the lifetime of the host. + */ + @JsonProperty(value = "hostId", access = JsonProperty.Access.WRITE_ONLY) + private String hostId; + + /* + * A list of references to all virtual machines in the Dedicated Host. + */ + @JsonProperty(value = "virtualMachines", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachines; + + /* + * Specifies the software license type that will be applied to the VMs + * deployed on the dedicated host.

Possible values are:

+ * **None**

**Windows_Server_Hybrid**

+ * **Windows_Server_Perpetual**

Default: **None** + */ + @JsonProperty(value = "licenseType") + private DedicatedHostLicenseTypes licenseType; + + /* + * The date when the host was first provisioned. + */ + @JsonProperty(value = "provisioningTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime provisioningTime; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The dedicated host instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private DedicatedHostInstanceView instanceView; + + /* + * Specifies the time at which the Dedicated Host resource was + * created.

Minimum api-version: 2021-11-01. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /** + * Get the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.platformFaultDomain; + } + + /** + * Set the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the DedicatedHostProperties object itself. + */ + public DedicatedHostProperties withPlatformFaultDomain(Integer platformFaultDomain) { + this.platformFaultDomain = platformFaultDomain; + return this; + } + + /** + * Get the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @return the autoReplaceOnFailure value. + */ + public Boolean autoReplaceOnFailure() { + return this.autoReplaceOnFailure; + } + + /** + * Set the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @param autoReplaceOnFailure the autoReplaceOnFailure value to set. + * @return the DedicatedHostProperties object itself. + */ + public DedicatedHostProperties withAutoReplaceOnFailure(Boolean autoReplaceOnFailure) { + this.autoReplaceOnFailure = autoReplaceOnFailure; + return this; + } + + /** + * Get the hostId property: A unique id generated and assigned to the dedicated host by the platform. + * <br><br> Does not change throughout the lifetime of the host. + * + * @return the hostId value. + */ + public String hostId() { + return this.hostId; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the Dedicated Host. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Get the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @return the licenseType value. + */ + public DedicatedHostLicenseTypes licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @param licenseType the licenseType value to set. + * @return the DedicatedHostProperties object itself. + */ + public DedicatedHostProperties withLicenseType(DedicatedHostLicenseTypes licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the provisioningTime property: The date when the host was first provisioned. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.provisioningTime; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The dedicated host instance view. + * + * @return the instanceView value. + */ + public DedicatedHostInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the timeCreated property: Specifies the time at which the Dedicated Host resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachines() != null) { + virtualMachines().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessInner.java new file mode 100644 index 0000000000000..28ba9d67603f3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** disk access resource. */ +@Fluent +public final class DiskAccessInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskAccessInner.class); + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private DiskAccessProperties innerProperties; + + /* + * The extended location where the disk access will be created. Extended + * location cannot be changed. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private DiskAccessProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: The extended location where the disk access will be created. Extended location + * cannot be changed. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location where the disk access will be created. Extended location + * cannot be changed. + * + * @param extendedLocation the extendedLocation value to set. + * @return the DiskAccessInner object itself. + */ + public DiskAccessInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public DiskAccessInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DiskAccessInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the privateEndpointConnections property: A readonly collection of private endpoint connections created on the + * disk. Currently only one endpoint connection is supported. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the provisioningState property: The disk access resource provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the timeCreated property: The time when the disk access was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessProperties.java new file mode 100644 index 0000000000000..df1d35e9f96a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskAccessProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The DiskAccessProperties model. */ +@Immutable +public final class DiskAccessProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskAccessProperties.class); + + /* + * A readonly collection of private endpoint connections created on the + * disk. Currently only one endpoint connection is supported. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * The disk access resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The time when the disk access was created. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /** + * Get the privateEndpointConnections property: A readonly collection of private endpoint connections created on the + * disk. Currently only one endpoint connection is supported. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the provisioningState property: The disk access resource provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the timeCreated property: The time when the disk access was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetInner.java new file mode 100644 index 0000000000000..5eb37650e3782 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetInner.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** disk encryption set resource. */ +@Fluent +public final class DiskEncryptionSetInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetInner.class); + + /* + * The managed identity for the disk encryption set. It should be given + * permission on the key vault before it can be used to encrypt disks. + */ + @JsonProperty(value = "identity") + private EncryptionSetIdentity identity; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private EncryptionSetProperties innerProperties; + + /** + * Get the identity property: The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * + * @return the identity value. + */ + public EncryptionSetIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * + * @param identity the identity value to set. + * @return the DiskEncryptionSetInner object itself. + */ + public DiskEncryptionSetInner withIdentity(EncryptionSetIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private EncryptionSetProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DiskEncryptionSetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DiskEncryptionSetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @return the encryptionType value. + */ + public DiskEncryptionSetType encryptionType() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionType(); + } + + /** + * Set the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @param encryptionType the encryptionType value to set. + * @return the DiskEncryptionSetInner object itself. + */ + public DiskEncryptionSetInner withEncryptionType(DiskEncryptionSetType encryptionType) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionSetProperties(); + } + this.innerProperties().withEncryptionType(encryptionType); + return this; + } + + /** + * Get the activeKey property: The key vault key which is currently used by this disk encryption set. + * + * @return the activeKey value. + */ + public KeyForDiskEncryptionSet activeKey() { + return this.innerProperties() == null ? null : this.innerProperties().activeKey(); + } + + /** + * Set the activeKey property: The key vault key which is currently used by this disk encryption set. + * + * @param activeKey the activeKey value to set. + * @return the DiskEncryptionSetInner object itself. + */ + public DiskEncryptionSetInner withActiveKey(KeyForDiskEncryptionSet activeKey) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionSetProperties(); + } + this.innerProperties().withActiveKey(activeKey); + return this; + } + + /** + * Get the previousKeys property: A readonly collection of key vault keys previously used by this disk encryption + * set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. + * + * @return the previousKeys value. + */ + public List previousKeys() { + return this.innerProperties() == null ? null : this.innerProperties().previousKeys(); + } + + /** + * Get the provisioningState property: The disk encryption set provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().rotationToLatestKeyVersionEnabled(); + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the DiskEncryptionSetInner object itself. + */ + public DiskEncryptionSetInner withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionSetProperties(); + } + this.innerProperties().withRotationToLatestKeyVersionEnabled(rotationToLatestKeyVersionEnabled); + return this; + } + + /** + * Get the lastKeyRotationTimestamp property: The time when the active key of this disk encryption set was updated. + * + * @return the lastKeyRotationTimestamp value. + */ + public OffsetDateTime lastKeyRotationTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().lastKeyRotationTimestamp(); + } + + /** + * Get the autoKeyRotationError property: The error that was encountered during auto-key rotation. If an error is + * present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. + * + * @return the autoKeyRotationError value. + */ + public ApiError autoKeyRotationError() { + return this.innerProperties() == null ? null : this.innerProperties().autoKeyRotationError(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetUpdateProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetUpdateProperties.java new file mode 100644 index 0000000000000..4aaa100fb8732 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskEncryptionSetUpdateProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** disk encryption set resource update properties. */ +@Fluent +public final class DiskEncryptionSetUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetUpdateProperties.class); + + /* + * The type of key used to encrypt the data of the disk. + */ + @JsonProperty(value = "encryptionType") + private DiskEncryptionSetType encryptionType; + + /* + * Key Vault Key Url to be used for server side encryption of Managed Disks + * and Snapshots + */ + @JsonProperty(value = "activeKey") + private KeyForDiskEncryptionSet activeKey; + + /* + * Set this flag to true to enable auto-updating of this disk encryption + * set to the latest key version. + */ + @JsonProperty(value = "rotationToLatestKeyVersionEnabled") + private Boolean rotationToLatestKeyVersionEnabled; + + /** + * Get the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @return the encryptionType value. + */ + public DiskEncryptionSetType encryptionType() { + return this.encryptionType; + } + + /** + * Set the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @param encryptionType the encryptionType value to set. + * @return the DiskEncryptionSetUpdateProperties object itself. + */ + public DiskEncryptionSetUpdateProperties withEncryptionType(DiskEncryptionSetType encryptionType) { + this.encryptionType = encryptionType; + return this; + } + + /** + * Get the activeKey property: Key Vault Key Url to be used for server side encryption of Managed Disks and + * Snapshots. + * + * @return the activeKey value. + */ + public KeyForDiskEncryptionSet activeKey() { + return this.activeKey; + } + + /** + * Set the activeKey property: Key Vault Key Url to be used for server side encryption of Managed Disks and + * Snapshots. + * + * @param activeKey the activeKey value to set. + * @return the DiskEncryptionSetUpdateProperties object itself. + */ + public DiskEncryptionSetUpdateProperties withActiveKey(KeyForDiskEncryptionSet activeKey) { + this.activeKey = activeKey; + return this; + } + + /** + * Get the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.rotationToLatestKeyVersionEnabled; + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the DiskEncryptionSetUpdateProperties object itself. + */ + public DiskEncryptionSetUpdateProperties withRotationToLatestKeyVersionEnabled( + Boolean rotationToLatestKeyVersionEnabled) { + this.rotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activeKey() != null) { + activeKey().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskInner.java new file mode 100644 index 0000000000000..3e843cfc0084c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskInner.java @@ -0,0 +1,779 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskSku; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PropertyUpdatesInProgress; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.ShareInfoElement; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Disk resource. */ +@Fluent +public final class DiskInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskInner.class); + + /* + * A relative URI containing the ID of the VM that has the disk attached. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /* + * List of relative URIs containing the IDs of the VMs that have the disk + * attached. maxShares should be set to a value greater than one for disks + * to allow attaching them to multiple VMs. + */ + @JsonProperty(value = "managedByExtended", access = JsonProperty.Access.WRITE_ONLY) + private List managedByExtended; + + /* + * The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + * UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + */ + @JsonProperty(value = "sku") + private DiskSku sku; + + /* + * The Logical zone list for Disk. + */ + @JsonProperty(value = "zones") + private List zones; + + /* + * The extended location where the disk will be created. Extended location + * cannot be changed. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * Disk resource properties. + */ + @JsonProperty(value = "properties") + private DiskProperties innerProperties; + + /** + * Get the managedBy property: A relative URI containing the ID of the VM that has the disk attached. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the managedByExtended property: List of relative URIs containing the IDs of the VMs that have the disk + * attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. + * + * @return the managedByExtended value. + */ + public List managedByExtended() { + return this.managedByExtended; + } + + /** + * Get the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * + * @return the sku value. + */ + public DiskSku sku() { + return this.sku; + } + + /** + * Set the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * + * @param sku the sku value to set. + * @return the DiskInner object itself. + */ + public DiskInner withSku(DiskSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the zones property: The Logical zone list for Disk. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The Logical zone list for Disk. + * + * @param zones the zones value to set. + * @return the DiskInner object itself. + */ + public DiskInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the extendedLocation property: The extended location where the disk will be created. Extended location cannot + * be changed. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location where the disk will be created. Extended location cannot + * be changed. + * + * @param extendedLocation the extendedLocation value to set. + * @return the DiskInner object itself. + */ + public DiskInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the innerProperties property: Disk resource properties. + * + * @return the innerProperties value. + */ + private DiskProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DiskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DiskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the timeCreated property: The time when the disk was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: The Operating System type. + * + * @param osType the osType value to set. + * @return the DiskInner object itself. + */ + public DiskInner withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the DiskInner object itself. + */ + public DiskInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskInner object itself. + */ + public DiskInner withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities for the image from which the OS disk was + * created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities(); + } + + /** + * Set the supportedCapabilities property: List of supported capabilities for the image from which the OS disk was + * created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskInner object itself. + */ + public DiskInner withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withSupportedCapabilities(supportedCapabilities); + return this; + } + + /** + * Get the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @return the creationData value. + */ + public CreationData creationData() { + return this.innerProperties() == null ? null : this.innerProperties().creationData(); + } + + /** + * Set the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @param creationData the creationData value to set. + * @return the DiskInner object itself. + */ + public DiskInner withCreationData(CreationData creationData) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withCreationData(creationData); + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeGB(); + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskSizeGB(Integer diskSizeGB) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskSizeGB(diskSizeGB); + return this; + } + + /** + * Get the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + public Long diskSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeBytes(); + } + + /** + * Get the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerProperties() == null ? null : this.innerProperties().uniqueId(); + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionSettingsCollection(); + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the DiskInner object itself. + */ + public DiskInner withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + + /** + * Get the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.innerProperties() == null ? null : this.innerProperties().diskIopsReadWrite(); + } + + /** + * Set the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskIopsReadWrite(Long diskIopsReadWrite) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskIopsReadWrite(diskIopsReadWrite); + return this; + } + + /** + * Get the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.innerProperties() == null ? null : this.innerProperties().diskMBpsReadWrite(); + } + + /** + * Set the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskMBpsReadWrite(diskMBpsReadWrite); + return this; + } + + /** + * Get the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadOnly value. + */ + public Long diskIopsReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().diskIopsReadOnly(); + } + + /** + * Set the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadOnly the diskIopsReadOnly value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskIopsReadOnly(Long diskIopsReadOnly) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskIopsReadOnly(diskIopsReadOnly); + return this; + } + + /** + * Get the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @return the diskMBpsReadOnly value. + */ + public Long diskMBpsReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().diskMBpsReadOnly(); + } + + /** + * Set the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @param diskMBpsReadOnly the diskMBpsReadOnly value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskMBpsReadOnly(Long diskMBpsReadOnly) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskMBpsReadOnly(diskMBpsReadOnly); + return this; + } + + /** + * Get the diskState property: The state of the disk. + * + * @return the diskState value. + */ + public DiskState diskState() { + return this.innerProperties() == null ? null : this.innerProperties().diskState(); + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the DiskInner object itself. + */ + public DiskInner withEncryption(Encryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * 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 Integer maxShares() { + return this.innerProperties() == null ? null : this.innerProperties().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 DiskInner object itself. + */ + public DiskInner withMaxShares(Integer maxShares) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withMaxShares(maxShares); + return this; + } + + /** + * Get the shareInfo property: Details of the list of all VMs that have the disk attached. maxShares should be set + * to a value greater than one for disks to allow attaching them to multiple VMs. + * + * @return the shareInfo value. + */ + public List shareInfo() { + return this.innerProperties() == null ? null : this.innerProperties().shareInfo(); + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy(); + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskInner object itself. + */ + public DiskInner withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.innerProperties() == null ? null : this.innerProperties().diskAccessId(); + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskAccessId(String diskAccessId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withDiskAccessId(diskAccessId); + return this; + } + + /** + * Get the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @return the tier value. + */ + public String tier() { + return this.innerProperties() == null ? null : this.innerProperties().tier(); + } + + /** + * Set the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @param tier the tier value to set. + * @return the DiskInner object itself. + */ + public DiskInner withTier(String tier) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withTier(tier); + return this; + } + + /** + * Get the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @return the burstingEnabled value. + */ + public Boolean burstingEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().burstingEnabled(); + } + + /** + * Set the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @param burstingEnabled the burstingEnabled value to set. + * @return the DiskInner object itself. + */ + public DiskInner withBurstingEnabled(Boolean burstingEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withBurstingEnabled(burstingEnabled); + return this; + } + + /** + * Get the propertyUpdatesInProgress property: Properties of the disk for which update is pending. + * + * @return the propertyUpdatesInProgress value. + */ + public PropertyUpdatesInProgress propertyUpdatesInProgress() { + return this.innerProperties() == null ? null : this.innerProperties().propertyUpdatesInProgress(); + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation(); + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskInner object itself. + */ + public DiskInner withSupportsHibernation(Boolean supportsHibernation) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withSupportsHibernation(supportsHibernation); + return this; + } + + /** + * Get the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + public DiskSecurityProfile securityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().securityProfile(); + } + + /** + * Set the securityProfile property: Contains the security related information for the resource. + * + * @param securityProfile the securityProfile value to set. + * @return the DiskInner object itself. + */ + public DiskInner withSecurityProfile(DiskSecurityProfile securityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withSecurityProfile(securityProfile); + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.innerProperties() == null ? null : this.innerProperties().completionPercent(); + } + + /** + * Set the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @param completionPercent the completionPercent value to set. + * @return the DiskInner object itself. + */ + public DiskInner withCompletionPercent(Float completionPercent) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withCompletionPercent(completionPercent); + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskInner object itself. + */ + public DiskInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskProperties.java new file mode 100644 index 0000000000000..71716a4579b32 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskProperties.java @@ -0,0 +1,780 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PropertyUpdatesInProgress; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.ShareInfoElement; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Disk resource properties. */ +@Fluent +public final class DiskProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskProperties.class); + + /* + * The time when the disk was created. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /* + * The Operating System type. + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * Purchase plan information for the the image from which the OS disk was + * created. E.g. - {name: 2019-Datacenter, publisher: + * MicrosoftWindowsServer, product: WindowsServer} + */ + @JsonProperty(value = "purchasePlan") + private PurchasePlanAutoGenerated purchasePlan; + + /* + * List of supported capabilities for the image from which the OS disk was + * created. + */ + @JsonProperty(value = "supportedCapabilities") + private SupportedCapabilities supportedCapabilities; + + /* + * Disk source information. CreationData information cannot be changed + * after the disk has been created. + */ + @JsonProperty(value = "creationData", required = true) + private CreationData creationData; + + /* + * If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for + * updates or creation with other options, it indicates a resize. Resizes + * are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The size of the disk in bytes. This field is read only. + */ + @JsonProperty(value = "diskSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long diskSizeBytes; + + /* + * Unique Guid identifying the resource. + */ + @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueId; + + /* + * Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + */ + @JsonProperty(value = "encryptionSettingsCollection") + private EncryptionSettingsCollection encryptionSettingsCollection; + + /* + * The disk provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The number of IOPS allowed for this disk; only settable for UltraSSD + * disks. One operation can transfer between 4k and 256k bytes. + */ + @JsonProperty(value = "diskIOPSReadWrite") + private Long diskIopsReadWrite; + + /* + * The bandwidth allowed for this disk; only settable for UltraSSD disks. + * MBps means millions of bytes per second - MB here uses the ISO notation, + * of powers of 10. + */ + @JsonProperty(value = "diskMBpsReadWrite") + private Long diskMBpsReadWrite; + + /* + * The total number of IOPS that will be allowed across all VMs mounting + * the shared disk as ReadOnly. One operation can transfer between 4k and + * 256k bytes. + */ + @JsonProperty(value = "diskIOPSReadOnly") + private Long diskIopsReadOnly; + + /* + * The total throughput (MBps) that will be allowed across all VMs mounting + * the shared disk as ReadOnly. MBps means millions of bytes per second - + * MB here uses the ISO notation, of powers of 10. + */ + @JsonProperty(value = "diskMBpsReadOnly") + private Long diskMBpsReadOnly; + + /* + * The state of the disk. + */ + @JsonProperty(value = "diskState", access = JsonProperty.Access.WRITE_ONLY) + private DiskState diskState; + + /* + * Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys. + */ + @JsonProperty(value = "encryption") + private Encryption encryption; + + /* + * 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. + */ + @JsonProperty(value = "maxShares") + private Integer maxShares; + + /* + * Details of the list of all VMs that have the disk attached. maxShares + * should be set to a value greater than one for disks to allow attaching + * them to multiple VMs. + */ + @JsonProperty(value = "shareInfo", access = JsonProperty.Access.WRITE_ONLY) + private List shareInfo; + + /* + * Policy for accessing the disk via network. + */ + @JsonProperty(value = "networkAccessPolicy") + private NetworkAccessPolicy networkAccessPolicy; + + /* + * ARM id of the DiskAccess resource for using private endpoints on disks. + */ + @JsonProperty(value = "diskAccessId") + private String diskAccessId; + + /* + * Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does + * not apply to Ultra disks. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Set to true to enable bursting beyond the provisioned performance target + * of the disk. Bursting is disabled by default. Does not apply to Ultra + * disks. + */ + @JsonProperty(value = "burstingEnabled") + private Boolean burstingEnabled; + + /* + * Properties of the disk for which update is pending. + */ + @JsonProperty(value = "propertyUpdatesInProgress", access = JsonProperty.Access.WRITE_ONLY) + private PropertyUpdatesInProgress propertyUpdatesInProgress; + + /* + * Indicates the OS on a disk supports hibernation. + */ + @JsonProperty(value = "supportsHibernation") + private Boolean supportsHibernation; + + /* + * Contains the security related information for the resource. + */ + @JsonProperty(value = "securityProfile") + private DiskSecurityProfile securityProfile; + + /* + * Percentage complete for the background copy when a resource is created + * via the CopyStart operation. + */ + @JsonProperty(value = "completionPercent") + private Float completionPercent; + + /* + * Policy for controlling export on the disk. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /** + * Get the timeCreated property: The time when the disk was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: The Operating System type. + * + * @param osType the osType value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities for the image from which the OS disk was + * created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.supportedCapabilities; + } + + /** + * Set the supportedCapabilities property: List of supported capabilities for the image from which the OS disk was + * created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + this.supportedCapabilities = supportedCapabilities; + return this; + } + + /** + * Get the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @return the creationData value. + */ + public CreationData creationData() { + return this.creationData; + } + + /** + * Set the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @param creationData the creationData value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withCreationData(CreationData creationData) { + this.creationData = creationData; + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + public Long diskSizeBytes() { + return this.diskSizeBytes; + } + + /** + * Get the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.encryptionSettingsCollection; + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + this.encryptionSettingsCollection = encryptionSettingsCollection; + return this; + } + + /** + * Get the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.diskIopsReadWrite; + } + + /** + * Set the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskIopsReadWrite(Long diskIopsReadWrite) { + this.diskIopsReadWrite = diskIopsReadWrite; + return this; + } + + /** + * Get the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.diskMBpsReadWrite; + } + + /** + * Set the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + this.diskMBpsReadWrite = diskMBpsReadWrite; + return this; + } + + /** + * Get the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadOnly value. + */ + public Long diskIopsReadOnly() { + return this.diskIopsReadOnly; + } + + /** + * Set the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadOnly the diskIopsReadOnly value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskIopsReadOnly(Long diskIopsReadOnly) { + this.diskIopsReadOnly = diskIopsReadOnly; + return this; + } + + /** + * Get the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @return the diskMBpsReadOnly value. + */ + public Long diskMBpsReadOnly() { + return this.diskMBpsReadOnly; + } + + /** + * Set the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @param diskMBpsReadOnly the diskMBpsReadOnly value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskMBpsReadOnly(Long diskMBpsReadOnly) { + this.diskMBpsReadOnly = diskMBpsReadOnly; + return this; + } + + /** + * Get the diskState property: The state of the disk. + * + * @return the diskState value. + */ + public DiskState diskState() { + return this.diskState; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * 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 Integer 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 DiskProperties object itself. + */ + public DiskProperties withMaxShares(Integer maxShares) { + this.maxShares = maxShares; + return this; + } + + /** + * Get the shareInfo property: Details of the list of all VMs that have the disk attached. maxShares should be set + * to a value greater than one for disks to allow attaching them to multiple VMs. + * + * @return the shareInfo value. + */ + public List shareInfo() { + return this.shareInfo; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.networkAccessPolicy; + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + this.networkAccessPolicy = networkAccessPolicy; + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.diskAccessId; + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withDiskAccessId(String diskAccessId) { + this.diskAccessId = diskAccessId; + return this; + } + + /** + * Get the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @param tier the tier value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @return the burstingEnabled value. + */ + public Boolean burstingEnabled() { + return this.burstingEnabled; + } + + /** + * Set the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @param burstingEnabled the burstingEnabled value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withBurstingEnabled(Boolean burstingEnabled) { + this.burstingEnabled = burstingEnabled; + return this; + } + + /** + * Get the propertyUpdatesInProgress property: Properties of the disk for which update is pending. + * + * @return the propertyUpdatesInProgress value. + */ + public PropertyUpdatesInProgress propertyUpdatesInProgress() { + return this.propertyUpdatesInProgress; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.supportsHibernation; + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withSupportsHibernation(Boolean supportsHibernation) { + this.supportsHibernation = supportsHibernation; + return this; + } + + /** + * Get the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + public DiskSecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Contains the security related information for the resource. + * + * @param securityProfile the securityProfile value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withSecurityProfile(DiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.completionPercent; + } + + /** + * Set the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @param completionPercent the completionPercent value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withCompletionPercent(Float completionPercent) { + this.completionPercent = completionPercent; + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskProperties object itself. + */ + public DiskProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (purchasePlan() != null) { + purchasePlan().validate(); + } + if (supportedCapabilities() != null) { + supportedCapabilities().validate(); + } + if (creationData() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property creationData in model DiskProperties")); + } else { + creationData().validate(); + } + if (encryptionSettingsCollection() != null) { + encryptionSettingsCollection().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (shareInfo() != null) { + shareInfo().forEach(e -> e.validate()); + } + if (propertyUpdatesInProgress() != null) { + propertyUpdatesInProgress().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointInner.java new file mode 100644 index 0000000000000..b6cbc30d440ef --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointInner.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.ProxyOnlyResource; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of disk restore point. */ +@Fluent +public final class DiskRestorePointInner extends ProxyOnlyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskRestorePointInner.class); + + /* + * Properties of an incremental disk restore point + */ + @JsonProperty(value = "properties") + private DiskRestorePointProperties innerProperties; + + /** + * Get the innerProperties property: Properties of an incremental disk restore point. + * + * @return the innerProperties value. + */ + private DiskRestorePointProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timeCreated property: The timestamp of restorePoint creation. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Get the sourceResourceId property: arm id of source disk or source disk restore point. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities(); + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withSupportedCapabilities(supportedCapabilities); + return this; + } + + /** + * Get the familyId property: id of the backing snapshot's MIS family. + * + * @return the familyId value. + */ + public String familyId() { + return this.innerProperties() == null ? null : this.innerProperties().familyId(); + } + + /** + * Get the sourceUniqueId property: unique incarnation id of the source disk. + * + * @return the sourceUniqueId value. + */ + public String sourceUniqueId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceUniqueId(); + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation(); + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withSupportsHibernation(Boolean supportsHibernation) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withSupportsHibernation(supportsHibernation); + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy(); + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.innerProperties() == null ? null : this.innerProperties().diskAccessId(); + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withDiskAccessId(String diskAccessId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withDiskAccessId(diskAccessId); + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy of disk restore point when source + * resource is from a different region. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.innerProperties() == null ? null : this.innerProperties().completionPercent(); + } + + /** + * Set the completionPercent property: Percentage complete for the background copy of disk restore point when source + * resource is from a different region. + * + * @param completionPercent the completionPercent value to set. + * @return the DiskRestorePointInner object itself. + */ + public DiskRestorePointInner withCompletionPercent(Float completionPercent) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskRestorePointProperties(); + } + this.innerProperties().withCompletionPercent(completionPercent); + return this; + } + + /** + * Get the replicationState property: Replication state of disk restore point when source resource is from a + * different region. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the sourceResourceLocation property: Location of source disk or source disk restore point when source + * resource is from a different region. + * + * @return the sourceResourceLocation value. + */ + public String sourceResourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceLocation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointProperties.java new file mode 100644 index 0000000000000..c2a74af393b2b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskRestorePointProperties.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an incremental disk restore point. */ +@Fluent +public final class DiskRestorePointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskRestorePointProperties.class); + + /* + * The timestamp of restorePoint creation + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /* + * arm id of source disk or source disk restore point. + */ + @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceId; + + /* + * The Operating System type. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private OperatingSystemTypes osType; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * Purchase plan information for the the image from which the OS disk was + * created. + */ + @JsonProperty(value = "purchasePlan") + private PurchasePlanAutoGenerated purchasePlan; + + /* + * List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + */ + @JsonProperty(value = "supportedCapabilities") + private SupportedCapabilities supportedCapabilities; + + /* + * id of the backing snapshot's MIS family + */ + @JsonProperty(value = "familyId", access = JsonProperty.Access.WRITE_ONLY) + private String familyId; + + /* + * unique incarnation id of the source disk + */ + @JsonProperty(value = "sourceUniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceUniqueId; + + /* + * Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys. + */ + @JsonProperty(value = "encryption", access = JsonProperty.Access.WRITE_ONLY) + private Encryption encryption; + + /* + * Indicates the OS on a disk supports hibernation. + */ + @JsonProperty(value = "supportsHibernation") + private Boolean supportsHibernation; + + /* + * Policy for accessing the disk via network. + */ + @JsonProperty(value = "networkAccessPolicy") + private NetworkAccessPolicy networkAccessPolicy; + + /* + * Policy for controlling export on the disk. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * ARM id of the DiskAccess resource for using private endpoints on disks. + */ + @JsonProperty(value = "diskAccessId") + private String diskAccessId; + + /* + * Percentage complete for the background copy of disk restore point when + * source resource is from a different region. + */ + @JsonProperty(value = "completionPercent") + private Float completionPercent; + + /* + * Replication state of disk restore point when source resource is from a + * different region. + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * Location of source disk or source disk restore point when source + * resource is from a different region. + */ + @JsonProperty(value = "sourceResourceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String sourceResourceLocation; + + /** + * Get the timeCreated property: The timestamp of restorePoint creation. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Get the sourceResourceId property: arm id of source disk or source disk restore point. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.supportedCapabilities; + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + this.supportedCapabilities = supportedCapabilities; + return this; + } + + /** + * Get the familyId property: id of the backing snapshot's MIS family. + * + * @return the familyId value. + */ + public String familyId() { + return this.familyId; + } + + /** + * Get the sourceUniqueId property: unique incarnation id of the source disk. + * + * @return the sourceUniqueId value. + */ + public String sourceUniqueId() { + return this.sourceUniqueId; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.supportsHibernation; + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withSupportsHibernation(Boolean supportsHibernation) { + this.supportsHibernation = supportsHibernation; + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.networkAccessPolicy; + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + this.networkAccessPolicy = networkAccessPolicy; + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.diskAccessId; + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withDiskAccessId(String diskAccessId) { + this.diskAccessId = diskAccessId; + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy of disk restore point when source + * resource is from a different region. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.completionPercent; + } + + /** + * Set the completionPercent property: Percentage complete for the background copy of disk restore point when source + * resource is from a different region. + * + * @param completionPercent the completionPercent value to set. + * @return the DiskRestorePointProperties object itself. + */ + public DiskRestorePointProperties withCompletionPercent(Float completionPercent) { + this.completionPercent = completionPercent; + return this; + } + + /** + * Get the replicationState property: Replication state of disk restore point when source resource is from a + * different region. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the sourceResourceLocation property: Location of source disk or source disk restore point when source + * resource is from a different region. + * + * @return the sourceResourceLocation value. + */ + public String sourceResourceLocation() { + return this.sourceResourceLocation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (purchasePlan() != null) { + purchasePlan().validate(); + } + if (supportedCapabilities() != null) { + supportedCapabilities().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskUpdateProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskUpdateProperties.java new file mode 100644 index 0000000000000..1d59a8151d90a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/DiskUpdateProperties.java @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PropertyUpdatesInProgress; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Disk resource update properties. */ +@Fluent +public final class DiskUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskUpdateProperties.class); + + /* + * the Operating System type. + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for + * updates or creation with other options, it indicates a resize. Resizes + * are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + */ + @JsonProperty(value = "encryptionSettingsCollection") + private EncryptionSettingsCollection encryptionSettingsCollection; + + /* + * The number of IOPS allowed for this disk; only settable for UltraSSD + * disks. One operation can transfer between 4k and 256k bytes. + */ + @JsonProperty(value = "diskIOPSReadWrite") + private Long diskIopsReadWrite; + + /* + * The bandwidth allowed for this disk; only settable for UltraSSD disks. + * MBps means millions of bytes per second - MB here uses the ISO notation, + * of powers of 10. + */ + @JsonProperty(value = "diskMBpsReadWrite") + private Long diskMBpsReadWrite; + + /* + * The total number of IOPS that will be allowed across all VMs mounting + * the shared disk as ReadOnly. One operation can transfer between 4k and + * 256k bytes. + */ + @JsonProperty(value = "diskIOPSReadOnly") + private Long diskIopsReadOnly; + + /* + * The total throughput (MBps) that will be allowed across all VMs mounting + * the shared disk as ReadOnly. MBps means millions of bytes per second - + * MB here uses the ISO notation, of powers of 10. + */ + @JsonProperty(value = "diskMBpsReadOnly") + private Long diskMBpsReadOnly; + + /* + * 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. + */ + @JsonProperty(value = "maxShares") + private Integer maxShares; + + /* + * Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys. + */ + @JsonProperty(value = "encryption") + private Encryption encryption; + + /* + * Policy for accessing the disk via network. + */ + @JsonProperty(value = "networkAccessPolicy") + private NetworkAccessPolicy networkAccessPolicy; + + /* + * ARM id of the DiskAccess resource for using private endpoints on disks. + */ + @JsonProperty(value = "diskAccessId") + private String diskAccessId; + + /* + * Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does + * not apply to Ultra disks. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Set to true to enable bursting beyond the provisioned performance target + * of the disk. Bursting is disabled by default. Does not apply to Ultra + * disks. + */ + @JsonProperty(value = "burstingEnabled") + private Boolean burstingEnabled; + + /* + * Purchase plan information to be added on the OS disk + */ + @JsonProperty(value = "purchasePlan") + private PurchasePlanAutoGenerated purchasePlan; + + /* + * List of supported capabilities (like accelerated networking) to be added + * on the OS disk. + */ + @JsonProperty(value = "supportedCapabilities") + private SupportedCapabilities supportedCapabilities; + + /* + * Properties of the disk for which update is pending. + */ + @JsonProperty(value = "propertyUpdatesInProgress", access = JsonProperty.Access.WRITE_ONLY) + private PropertyUpdatesInProgress propertyUpdatesInProgress; + + /* + * Indicates the OS on a disk supports hibernation. + */ + @JsonProperty(value = "supportsHibernation") + private Boolean supportsHibernation; + + /* + * Policy for controlling export on the disk. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /** + * Get the osType property: the Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: the Operating System type. + * + * @param osType the osType value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.encryptionSettingsCollection; + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withEncryptionSettingsCollection( + EncryptionSettingsCollection encryptionSettingsCollection) { + this.encryptionSettingsCollection = encryptionSettingsCollection; + return this; + } + + /** + * Get the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.diskIopsReadWrite; + } + + /** + * Set the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskIopsReadWrite(Long diskIopsReadWrite) { + this.diskIopsReadWrite = diskIopsReadWrite; + return this; + } + + /** + * Get the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.diskMBpsReadWrite; + } + + /** + * Set the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + this.diskMBpsReadWrite = diskMBpsReadWrite; + return this; + } + + /** + * Get the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadOnly value. + */ + public Long diskIopsReadOnly() { + return this.diskIopsReadOnly; + } + + /** + * Set the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadOnly the diskIopsReadOnly value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskIopsReadOnly(Long diskIopsReadOnly) { + this.diskIopsReadOnly = diskIopsReadOnly; + return this; + } + + /** + * Get the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @return the diskMBpsReadOnly value. + */ + public Long diskMBpsReadOnly() { + return this.diskMBpsReadOnly; + } + + /** + * Set the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @param diskMBpsReadOnly the diskMBpsReadOnly value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskMBpsReadOnly(Long diskMBpsReadOnly) { + this.diskMBpsReadOnly = diskMBpsReadOnly; + return this; + } + + /** + * 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 Integer 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 DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withMaxShares(Integer maxShares) { + this.maxShares = maxShares; + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.networkAccessPolicy; + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + this.networkAccessPolicy = networkAccessPolicy; + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.diskAccessId; + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withDiskAccessId(String diskAccessId) { + this.diskAccessId = diskAccessId; + return this; + } + + /** + * Get the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @param tier the tier value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @return the burstingEnabled value. + */ + public Boolean burstingEnabled() { + return this.burstingEnabled; + } + + /** + * Set the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @param burstingEnabled the burstingEnabled value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withBurstingEnabled(Boolean burstingEnabled) { + this.burstingEnabled = burstingEnabled; + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information to be added on the OS disk. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Purchase plan information to be added on the OS disk. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) to be added + * on the OS disk. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.supportedCapabilities; + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) to be added + * on the OS disk. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + this.supportedCapabilities = supportedCapabilities; + return this; + } + + /** + * Get the propertyUpdatesInProgress property: Properties of the disk for which update is pending. + * + * @return the propertyUpdatesInProgress value. + */ + public PropertyUpdatesInProgress propertyUpdatesInProgress() { + return this.propertyUpdatesInProgress; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.supportsHibernation; + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withSupportsHibernation(Boolean supportsHibernation) { + this.supportsHibernation = supportsHibernation; + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskUpdateProperties object itself. + */ + public DiskUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettingsCollection() != null) { + encryptionSettingsCollection().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (purchasePlan() != null) { + purchasePlan().validate(); + } + if (supportedCapabilities() != null) { + supportedCapabilities().validate(); + } + if (propertyUpdatesInProgress() != null) { + propertyUpdatesInProgress().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/EncryptionSetProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/EncryptionSetProperties.java new file mode 100644 index 0000000000000..203a67a06beaf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/EncryptionSetProperties.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The EncryptionSetProperties model. */ +@Fluent +public final class EncryptionSetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionSetProperties.class); + + /* + * The type of key used to encrypt the data of the disk. + */ + @JsonProperty(value = "encryptionType") + private DiskEncryptionSetType encryptionType; + + /* + * The key vault key which is currently used by this disk encryption set. + */ + @JsonProperty(value = "activeKey") + private KeyForDiskEncryptionSet activeKey; + + /* + * A readonly collection of key vault keys previously used by this disk + * encryption set while a key rotation is in progress. It will be empty if + * there is no ongoing key rotation. + */ + @JsonProperty(value = "previousKeys", access = JsonProperty.Access.WRITE_ONLY) + private List previousKeys; + + /* + * The disk encryption set provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Set this flag to true to enable auto-updating of this disk encryption + * set to the latest key version. + */ + @JsonProperty(value = "rotationToLatestKeyVersionEnabled") + private Boolean rotationToLatestKeyVersionEnabled; + + /* + * The time when the active key of this disk encryption set was updated. + */ + @JsonProperty(value = "lastKeyRotationTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastKeyRotationTimestamp; + + /* + * The error that was encountered during auto-key rotation. If an error is + * present, then auto-key rotation will not be attempted until the error on + * this disk encryption set is fixed. + */ + @JsonProperty(value = "autoKeyRotationError", access = JsonProperty.Access.WRITE_ONLY) + private ApiError autoKeyRotationError; + + /** + * Get the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @return the encryptionType value. + */ + public DiskEncryptionSetType encryptionType() { + return this.encryptionType; + } + + /** + * Set the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @param encryptionType the encryptionType value to set. + * @return the EncryptionSetProperties object itself. + */ + public EncryptionSetProperties withEncryptionType(DiskEncryptionSetType encryptionType) { + this.encryptionType = encryptionType; + return this; + } + + /** + * Get the activeKey property: The key vault key which is currently used by this disk encryption set. + * + * @return the activeKey value. + */ + public KeyForDiskEncryptionSet activeKey() { + return this.activeKey; + } + + /** + * Set the activeKey property: The key vault key which is currently used by this disk encryption set. + * + * @param activeKey the activeKey value to set. + * @return the EncryptionSetProperties object itself. + */ + public EncryptionSetProperties withActiveKey(KeyForDiskEncryptionSet activeKey) { + this.activeKey = activeKey; + return this; + } + + /** + * Get the previousKeys property: A readonly collection of key vault keys previously used by this disk encryption + * set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. + * + * @return the previousKeys value. + */ + public List previousKeys() { + return this.previousKeys; + } + + /** + * Get the provisioningState property: The disk encryption set provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.rotationToLatestKeyVersionEnabled; + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the EncryptionSetProperties object itself. + */ + public EncryptionSetProperties withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + this.rotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + return this; + } + + /** + * Get the lastKeyRotationTimestamp property: The time when the active key of this disk encryption set was updated. + * + * @return the lastKeyRotationTimestamp value. + */ + public OffsetDateTime lastKeyRotationTimestamp() { + return this.lastKeyRotationTimestamp; + } + + /** + * Get the autoKeyRotationError property: The error that was encountered during auto-key rotation. If an error is + * present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. + * + * @return the autoKeyRotationError value. + */ + public ApiError autoKeyRotationError() { + return this.autoKeyRotationError; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activeKey() != null) { + activeKey().validate(); + } + if (previousKeys() != null) { + previousKeys().forEach(e -> e.validate()); + } + if (autoKeyRotationError() != null) { + autoKeyRotationError().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationInner.java new file mode 100644 index 0000000000000..a3ba2a5514709 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationInner.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Specifies information about the gallery Application Definition that you want to create or update. */ +@Fluent +public final class GalleryApplicationInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationInner.class); + + /* + * Describes the properties of a gallery Application Definition. + */ + @JsonProperty(value = "properties") + private GalleryApplicationProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery Application Definition. + * + * @return the innerProperties value. + */ + private GalleryApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery Application Definition. + * + * @return the eula value. + */ + public String eula() { + return this.innerProperties() == null ? null : this.innerProperties().eula(); + } + + /** + * Set the eula property: The Eula agreement for the gallery Application Definition. + * + * @param eula the eula value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withEula(String eula) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withEula(eula); + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.innerProperties() == null ? null : this.innerProperties().privacyStatementUri(); + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withPrivacyStatementUri(String privacyStatementUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withPrivacyStatementUri(privacyStatementUri); + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.innerProperties() == null ? null : this.innerProperties().releaseNoteUri(); + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withReleaseNoteUri(String releaseNoteUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withReleaseNoteUri(releaseNoteUri); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the supportedOSType value. + */ + public OperatingSystemTypes supportedOSType() { + return this.innerProperties() == null ? null : this.innerProperties().supportedOSType(); + } + + /** + * Set the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param supportedOSType the supportedOSType value to set. + * @return the GalleryApplicationInner object itself. + */ + public GalleryApplicationInner withSupportedOSType(OperatingSystemTypes supportedOSType) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withSupportedOSType(supportedOSType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationProperties.java new file mode 100644 index 0000000000000..133a312115a5d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationProperties.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of a gallery Application Definition. */ +@Fluent +public final class GalleryApplicationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationProperties.class); + + /* + * The description of this gallery Application Definition resource. This + * property is updatable. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The Eula agreement for the gallery Application Definition. + */ + @JsonProperty(value = "eula") + private String eula; + + /* + * The privacy statement uri. + */ + @JsonProperty(value = "privacyStatementUri") + private String privacyStatementUri; + + /* + * The release note uri. + */ + @JsonProperty(value = "releaseNoteUri") + private String releaseNoteUri; + + /* + * The end of life date of the gallery Application Definition. This + * property can be used for decommissioning purposes. This property is + * updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /* + * This property allows you to specify the supported type of the OS that + * application is built for.

Possible values are:

+ * **Windows**

**Linux** + */ + @JsonProperty(value = "supportedOSType", required = true) + private OperatingSystemTypes supportedOSType; + + /** + * Get the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery Application Definition. + * + * @return the eula value. + */ + public String eula() { + return this.eula; + } + + /** + * Set the eula property: The Eula agreement for the gallery Application Definition. + * + * @param eula the eula value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withEula(String eula) { + this.eula = eula; + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.privacyStatementUri; + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withPrivacyStatementUri(String privacyStatementUri) { + this.privacyStatementUri = privacyStatementUri; + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.releaseNoteUri; + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withReleaseNoteUri(String releaseNoteUri) { + this.releaseNoteUri = releaseNoteUri; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + return this; + } + + /** + * Get the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the supportedOSType value. + */ + public OperatingSystemTypes supportedOSType() { + return this.supportedOSType; + } + + /** + * Set the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param supportedOSType the supportedOSType value to set. + * @return the GalleryApplicationProperties object itself. + */ + public GalleryApplicationProperties withSupportedOSType(OperatingSystemTypes supportedOSType) { + this.supportedOSType = supportedOSType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedOSType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property supportedOSType in model GalleryApplicationProperties")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionInner.java new file mode 100644 index 0000000000000..a09826b792100 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the gallery Application Version that you want to create or update. */ +@Fluent +public final class GalleryApplicationVersionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionInner.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private GalleryApplicationVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private GalleryApplicationVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publishingProfile property: The publishing profile of a gallery image version. + * + * @return the publishingProfile value. + */ + public GalleryApplicationVersionPublishingProfile publishingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().publishingProfile(); + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryApplicationVersionInner object itself. + */ + public GalleryApplicationVersionInner withPublishingProfile( + GalleryApplicationVersionPublishingProfile publishingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationVersionProperties(); + } + this.innerProperties().withPublishingProfile(publishingProfile); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery Application Version. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryApplicationVersionPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().replicationStatus(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionProperties.java new file mode 100644 index 0000000000000..0268b4a1f758f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryApplicationVersionProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a gallery image version. */ +@Fluent +public final class GalleryApplicationVersionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionProperties.class); + + /* + * The publishing profile of a gallery image version. + */ + @JsonProperty(value = "publishingProfile", required = true) + private GalleryApplicationVersionPublishingProfile publishingProfile; + + /* + * The current state of the gallery Application Version. The provisioning + * state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private GalleryApplicationVersionPropertiesProvisioningState provisioningState; + + /* + * This is the replication status of the gallery image version. + */ + @JsonProperty(value = "replicationStatus", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationStatus replicationStatus; + + /** + * Get the publishingProfile property: The publishing profile of a gallery image version. + * + * @return the publishingProfile value. + */ + public GalleryApplicationVersionPublishingProfile publishingProfile() { + return this.publishingProfile; + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryApplicationVersionProperties object itself. + */ + public GalleryApplicationVersionProperties withPublishingProfile( + GalleryApplicationVersionPublishingProfile publishingProfile) { + this.publishingProfile = publishingProfile; + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery Application Version. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryApplicationVersionPropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.replicationStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publishingProfile() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publishingProfile in model GalleryApplicationVersionProperties")); + } else { + publishingProfile().validate(); + } + if (replicationStatus() != null) { + replicationStatus().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageInner.java new file mode 100644 index 0000000000000..23e329ca48653 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageInner.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryImagePropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the gallery image definition that you want to create or update. */ +@Fluent +public final class GalleryImageInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageInner.class); + + /* + * Describes the properties of a gallery image definition. + */ + @JsonProperty(value = "properties") + private GalleryImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image definition. + * + * @return the innerProperties value. + */ + private GalleryImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery image definition. + * + * @return the eula value. + */ + public String eula() { + return this.innerProperties() == null ? null : this.innerProperties().eula(); + } + + /** + * Set the eula property: The Eula agreement for the gallery image definition. + * + * @param eula the eula value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withEula(String eula) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withEula(eula); + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.innerProperties() == null ? null : this.innerProperties().privacyStatementUri(); + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withPrivacyStatementUri(String privacyStatementUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withPrivacyStatementUri(privacyStatementUri); + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.innerProperties() == null ? null : this.innerProperties().releaseNoteUri(); + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withReleaseNoteUri(String releaseNoteUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withReleaseNoteUri(releaseNoteUri); + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.innerProperties() == null ? null : this.innerProperties().osState(); + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withOsState(OperatingSystemStateTypes osState) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withOsState(osState); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withIdentifier(GalleryImageIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.innerProperties() == null ? null : this.innerProperties().recommended(); + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withRecommended(RecommendedMachineConfiguration recommended) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withRecommended(recommended); + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.innerProperties() == null ? null : this.innerProperties().disallowed(); + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withDisallowed(Disallowed disallowed) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withDisallowed(disallowed); + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withPurchasePlan(ImagePurchasePlan purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image definition. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImagePropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.innerProperties() == null ? null : this.innerProperties().features(); + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withFeatures(List features) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withFeatures(features); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageProperties.java new file mode 100644 index 0000000000000..c32926cf47635 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageProperties.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryImagePropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the properties of a gallery image definition. */ +@Fluent +public final class GalleryImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageProperties.class); + + /* + * The description of this gallery image definition resource. This property + * is updatable. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The Eula agreement for the gallery image definition. + */ + @JsonProperty(value = "eula") + private String eula; + + /* + * The privacy statement uri. + */ + @JsonProperty(value = "privacyStatementUri") + private String privacyStatementUri; + + /* + * The release note uri. + */ + @JsonProperty(value = "releaseNoteUri") + private String releaseNoteUri; + + /* + * This property allows you to specify the type of the OS that is included + * in the disk when creating a VM from a managed image.

Possible + * values are:

**Windows**

**Linux** + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemTypes osType; + + /* + * This property allows the user to specify whether the virtual machines + * created under this image are 'Generalized' or 'Specialized'. + */ + @JsonProperty(value = "osState", required = true) + private OperatingSystemStateTypes osState; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * The end of life date of the gallery image definition. This property can + * be used for decommissioning purposes. This property is updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /* + * This is the gallery image definition identifier. + */ + @JsonProperty(value = "identifier", required = true) + private GalleryImageIdentifier identifier; + + /* + * The properties describe the recommended machine configuration for this + * Image Definition. These properties are updatable. + */ + @JsonProperty(value = "recommended") + private RecommendedMachineConfiguration recommended; + + /* + * Describes the disallowed disk types. + */ + @JsonProperty(value = "disallowed") + private Disallowed disallowed; + + /* + * Describes the gallery image definition purchase plan. This is used by + * marketplace images. + */ + @JsonProperty(value = "purchasePlan") + private ImagePurchasePlan purchasePlan; + + /* + * The current state of the gallery image definition. The provisioning + * state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private GalleryImagePropertiesProvisioningState provisioningState; + + /* + * A list of gallery image features. + */ + @JsonProperty(value = "features") + private List features; + + /** + * Get the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery image definition. + * + * @return the eula value. + */ + public String eula() { + return this.eula; + } + + /** + * Set the eula property: The Eula agreement for the gallery image definition. + * + * @param eula the eula value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withEula(String eula) { + this.eula = eula; + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.privacyStatementUri; + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withPrivacyStatementUri(String privacyStatementUri) { + this.privacyStatementUri = privacyStatementUri; + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.releaseNoteUri; + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withReleaseNoteUri(String releaseNoteUri) { + this.releaseNoteUri = releaseNoteUri; + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **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 when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **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 osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.osState; + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withOsState(OperatingSystemStateTypes osState) { + this.osState = osState; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + 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 recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.recommended; + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withRecommended(RecommendedMachineConfiguration recommended) { + this.recommended = recommended; + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.disallowed; + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withDisallowed(Disallowed disallowed) { + this.disallowed = disallowed; + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withPurchasePlan(ImagePurchasePlan purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image definition. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImagePropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.features; + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osType in model GalleryImageProperties")); + } + if (osState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osState in model GalleryImageProperties")); + } + if (identifier() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property identifier in model GalleryImageProperties")); + } else { + identifier().validate(); + } + if (recommended() != null) { + recommended().validate(); + } + if (disallowed() != null) { + disallowed().validate(); + } + if (purchasePlan() != null) { + purchasePlan().validate(); + } + if (features() != null) { + features().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionInner.java new file mode 100644 index 0000000000000..9bf31c5e5fd80 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the gallery image version that you want to create or update. */ +@Fluent +public final class GalleryImageVersionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionInner.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private GalleryImageVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private GalleryImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publishingProfile property: The publishing profile of a gallery image Version. + * + * @return the publishingProfile value. + */ + public GalleryImageVersionPublishingProfile publishingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().publishingProfile(); + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image Version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryImageVersionInner object itself. + */ + public GalleryImageVersionInner withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageVersionProperties(); + } + this.innerProperties().withPublishingProfile(publishingProfile); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image version. The provisioning state, which + * only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImageVersionPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * 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 GalleryImageVersionInner object itself. + */ + public GalleryImageVersionInner withStorageProfile(GalleryImageVersionStorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageVersionProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().replicationStatus(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionProperties.java new file mode 100644 index 0000000000000..e4884f5e1ee6f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryImageVersionProperties.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a gallery image version. */ +@Fluent +public final class GalleryImageVersionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionProperties.class); + + /* + * The publishing profile of a gallery image Version. + */ + @JsonProperty(value = "publishingProfile") + private GalleryImageVersionPublishingProfile publishingProfile; + + /* + * The current state of the gallery image version. The provisioning state, + * which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private GalleryImageVersionPropertiesProvisioningState provisioningState; + + /* + * This is the storage profile of a Gallery Image Version. + */ + @JsonProperty(value = "storageProfile", required = true) + private GalleryImageVersionStorageProfile storageProfile; + + /* + * This is the replication status of the gallery image version. + */ + @JsonProperty(value = "replicationStatus", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationStatus replicationStatus; + + /** + * Get the publishingProfile property: The publishing profile of a gallery image Version. + * + * @return the publishingProfile value. + */ + public GalleryImageVersionPublishingProfile publishingProfile() { + return this.publishingProfile; + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image Version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryImageVersionProperties object itself. + */ + public GalleryImageVersionProperties withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile) { + this.publishingProfile = publishingProfile; + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image version. The provisioning state, which + * only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImageVersionPropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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; + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.replicationStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publishingProfile() != null) { + publishingProfile().validate(); + } + if (storageProfile() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageProfile in model GalleryImageVersionProperties")); + } else { + storageProfile().validate(); + } + if (replicationStatus() != null) { + replicationStatus().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryInner.java new file mode 100644 index 0000000000000..2f5f08126e1bc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryInner.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.SharingProfile; +import com.azure.resourcemanager.compute.generated.models.SoftDeletePolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the Shared Image Gallery that you want to create or update. */ +@Fluent +public final class GalleryInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryInner.class); + + /* + * Describes the properties of a Shared Image Gallery. + */ + @JsonProperty(value = "properties") + private GalleryProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Shared Image Gallery. + * + * @return the innerProperties value. + */ + private GalleryProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @param description the description value to set. + * @return the GalleryInner object itself. + */ + public GalleryInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the identifier property: Describes the gallery unique name. + * + * @return the identifier value. + */ + public GalleryIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: Describes the gallery unique name. + * + * @param identifier the identifier value to set. + * @return the GalleryInner object itself. + */ + public GalleryInner withIdentifier(GalleryIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery. The provisioning state, which only appears + * in the response. + * + * @return the provisioningState value. + */ + public GalleryPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @return the sharingProfile value. + */ + public SharingProfile sharingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().sharingProfile(); + } + + /** + * Set the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @param sharingProfile the sharingProfile value to set. + * @return the GalleryInner object itself. + */ + public GalleryInner withSharingProfile(SharingProfile sharingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withSharingProfile(sharingProfile); + return this; + } + + /** + * Get the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @return the softDeletePolicy value. + */ + public SoftDeletePolicy softDeletePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().softDeletePolicy(); + } + + /** + * Set the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @param softDeletePolicy the softDeletePolicy value to set. + * @return the GalleryInner object itself. + */ + public GalleryInner withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withSoftDeletePolicy(softDeletePolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryProperties.java new file mode 100644 index 0000000000000..e634ecf2cd07f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/GalleryProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.GalleryIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.SharingProfile; +import com.azure.resourcemanager.compute.generated.models.SoftDeletePolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Shared Image Gallery. */ +@Fluent +public final class GalleryProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryProperties.class); + + /* + * The description of this Shared Image Gallery resource. This property is + * updatable. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Describes the gallery unique name. + */ + @JsonProperty(value = "identifier") + private GalleryIdentifier identifier; + + /* + * The current state of the gallery. The provisioning state, which only + * appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private GalleryPropertiesProvisioningState provisioningState; + + /* + * Profile for gallery sharing to subscription or tenant + */ + @JsonProperty(value = "sharingProfile") + private SharingProfile sharingProfile; + + /* + * Contains information about the soft deletion policy of the gallery. + */ + @JsonProperty(value = "softDeletePolicy") + private SoftDeletePolicy softDeletePolicy; + + /** + * Get the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @param description the description value to set. + * @return the GalleryProperties object itself. + */ + public GalleryProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the identifier property: Describes the gallery unique name. + * + * @return the identifier value. + */ + public GalleryIdentifier identifier() { + return this.identifier; + } + + /** + * Set the identifier property: Describes the gallery unique name. + * + * @param identifier the identifier value to set. + * @return the GalleryProperties object itself. + */ + public GalleryProperties withIdentifier(GalleryIdentifier identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery. The provisioning state, which only appears + * in the response. + * + * @return the provisioningState value. + */ + public GalleryPropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @return the sharingProfile value. + */ + public SharingProfile sharingProfile() { + return this.sharingProfile; + } + + /** + * Set the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @param sharingProfile the sharingProfile value to set. + * @return the GalleryProperties object itself. + */ + public GalleryProperties withSharingProfile(SharingProfile sharingProfile) { + this.sharingProfile = sharingProfile; + return this; + } + + /** + * Get the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @return the softDeletePolicy value. + */ + public SoftDeletePolicy softDeletePolicy() { + return this.softDeletePolicy; + } + + /** + * Set the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @param softDeletePolicy the softDeletePolicy value to set. + * @return the GalleryProperties object itself. + */ + public GalleryProperties withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy) { + this.softDeletePolicy = softDeletePolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identifier() != null) { + identifier().validate(); + } + if (sharingProfile() != null) { + sharingProfile().validate(); + } + if (softDeletePolicy() != null) { + softDeletePolicy().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageInner.java new file mode 100644 index 0000000000000..5662d48b8b9af --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageInner.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.ImageStorageProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual + * machine. If SourceImage is provided, the destination virtual hard drive must not exist. + */ +@Fluent +public final class ImageInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageInner.class); + + /* + * Describes the properties of an Image. + */ + @JsonProperty(value = "properties") + private ImageProperties innerProperties; + + /* + * The extended location of the Image. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Describes the properties of an Image. + * + * @return the innerProperties value. + */ + private ImageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: The extended location of the Image. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location of the Image. + * + * @param extendedLocation the extendedLocation value to set. + * @return the ImageInner object itself. + */ + public ImageInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @return the sourceVirtualMachine value. + */ + public SubResource sourceVirtualMachine() { + return this.innerProperties() == null ? null : this.innerProperties().sourceVirtualMachine(); + } + + /** + * Set the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @param sourceVirtualMachine the sourceVirtualMachine value to set. + * @return the ImageInner object itself. + */ + public ImageInner withSourceVirtualMachine(SubResource sourceVirtualMachine) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withSourceVirtualMachine(sourceVirtualMachine); + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public ImageStorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the ImageInner object itself. + */ + public ImageInner withStorageProfile(ImageStorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationTypes hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the ImageInner object itself. + */ + public ImageInner withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageProperties.java new file mode 100644 index 0000000000000..9734719f4d58c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ImageProperties.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.ImageStorageProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of an Image. */ +@Fluent +public final class ImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageProperties.class); + + /* + * The source virtual machine from which Image is created. + */ + @JsonProperty(value = "sourceVirtualMachine") + private SubResource sourceVirtualMachine; + + /* + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "storageProfile") + private ImageStorageProfile storageProfile; + + /* + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Specifies the HyperVGenerationType of the VirtualMachine created from + * the image. From API Version 2019-03-01 if the image source is a blob, + * then we need the user to specify the value, if the source is managed + * resource like disk or snapshot, we may require the user to specify the + * property if we cannot deduce it from the source managed resource. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGenerationTypes hyperVGeneration; + + /** + * Get the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @return the sourceVirtualMachine value. + */ + public SubResource sourceVirtualMachine() { + return this.sourceVirtualMachine; + } + + /** + * Set the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @param sourceVirtualMachine the sourceVirtualMachine value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withSourceVirtualMachine(SubResource sourceVirtualMachine) { + this.sourceVirtualMachine = sourceVirtualMachine; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public ImageStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withStorageProfile(ImageStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationTypes hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/LogAnalyticsOperationResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/LogAnalyticsOperationResultInner.java new file mode 100644 index 0000000000000..a9666c6e1473c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/LogAnalyticsOperationResultInner.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.LogAnalyticsOutput; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** LogAnalytics operation status response. */ +@Immutable +public final class LogAnalyticsOperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsOperationResultInner.class); + + /* + * LogAnalyticsOutput + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private LogAnalyticsOutput properties; + + /** + * Get the properties property: LogAnalyticsOutput. + * + * @return the properties value. + */ + public LogAnalyticsOutput properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/NetworkInterfaceReferenceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/NetworkInterfaceReferenceProperties.java new file mode 100644 index 0000000000000..8c75fc8741d9c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/NetworkInterfaceReferenceProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a network interface reference properties. */ +@Fluent +public final class NetworkInterfaceReferenceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkInterfaceReferenceProperties.class); + + /* + * Specifies the primary network interface in case the virtual machine has + * more than 1 network interface. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * Specify what happens to the network interface when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the NetworkInterfaceReferenceProperties object itself. + */ + public NetworkInterfaceReferenceProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the NetworkInterfaceReferenceProperties object itself. + */ + public NetworkInterfaceReferenceProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSFamilyInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSFamilyInner.java new file mode 100644 index 0000000000000..75c2df20f2f5f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSFamilyInner.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OSFamilyProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a cloud service OS family. */ +@Fluent +public final class OSFamilyInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSFamilyInner.class); + + /* + * Resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * OS family properties. + */ + @JsonProperty(value = "properties") + private OSFamilyProperties properties; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the properties property: OS family properties. + * + * @return the properties value. + */ + public OSFamilyProperties properties() { + return this.properties; + } + + /** + * Set the properties property: OS family properties. + * + * @param properties the properties value to set. + * @return the OSFamilyInner object itself. + */ + public OSFamilyInner withProperties(OSFamilyProperties 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(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSVersionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSVersionInner.java new file mode 100644 index 0000000000000..8e7dae290b04e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/OSVersionInner.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OSVersionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a cloud service OS version. */ +@Fluent +public final class OSVersionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSVersionInner.class); + + /* + * Resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * OS version properties. + */ + @JsonProperty(value = "properties") + private OSVersionProperties properties; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the properties property: OS version properties. + * + * @return the properties value. + */ + public OSVersionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: OS version properties. + * + * @param properties the properties value to set. + * @return the OSVersionInner object itself. + */ + public OSVersionInner withProperties(OSVersionProperties 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(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..3348de1d25d14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint Connection resource. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between DiskAccess and Virtual Network. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between DiskAccess and Virtual Network. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..96944f46f25f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the PrivateEndpointConnectProperties. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * The resource of private end point. + */ + @JsonProperty(value = "privateEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between + * DiskAccess and Virtual Network. + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between DiskAccess and Virtual Network. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between DiskAccess and Virtual Network. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceListResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceListResultInner.java new file mode 100644 index 0000000000000..b87ceb6fe93f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceListResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResultInner.class); + + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResultInner object itself. + */ + public PrivateLinkResourceListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..d01f10b8528bb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Fluent +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource DNS zone name. + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupInner.java new file mode 100644 index 0000000000000..07b310fb8820d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupInner.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupType; +import com.azure.resourcemanager.compute.generated.models.SubResourceWithColocationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Specifies information about the proximity placement group. */ +@Fluent +public final class ProximityPlacementGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupInner.class); + + /* + * Describes the properties of a Proximity Placement Group. + */ + @JsonProperty(value = "properties") + private ProximityPlacementGroupProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Proximity Placement Group. + * + * @return the innerProperties value. + */ + private ProximityPlacementGroupProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ProximityPlacementGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProximityPlacementGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within an Azure + * region or Availability Zone. <br><br> **Ultra** : For future use. + * + * @return the proximityPlacementGroupType value. + */ + public ProximityPlacementGroupType proximityPlacementGroupType() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroupType(); + } + + /** + * Set the proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within an Azure + * region or Availability Zone. <br><br> **Ultra** : For future use. + * + * @param proximityPlacementGroupType the proximityPlacementGroupType value to set. + * @return the ProximityPlacementGroupInner object itself. + */ + public ProximityPlacementGroupInner withProximityPlacementGroupType( + ProximityPlacementGroupType proximityPlacementGroupType) { + if (this.innerProperties() == null) { + this.innerProperties = new ProximityPlacementGroupProperties(); + } + this.innerProperties().withProximityPlacementGroupType(proximityPlacementGroupType); + return this; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the proximity placement group. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachines(); + } + + /** + * Get the virtualMachineScaleSets property: A list of references to all virtual machine scale sets in the proximity + * placement group. + * + * @return the virtualMachineScaleSets value. + */ + public List virtualMachineScaleSets() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineScaleSets(); + } + + /** + * Get the availabilitySets property: A list of references to all availability sets in the proximity placement + * group. + * + * @return the availabilitySets value. + */ + public List availabilitySets() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySets(); + } + + /** + * Get the colocationStatus property: Describes colocation status of the Proximity Placement Group. + * + * @return the colocationStatus value. + */ + public InstanceViewStatus colocationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().colocationStatus(); + } + + /** + * Set the colocationStatus property: Describes colocation status of the Proximity Placement Group. + * + * @param colocationStatus the colocationStatus value to set. + * @return the ProximityPlacementGroupInner object itself. + */ + public ProximityPlacementGroupInner withColocationStatus(InstanceViewStatus colocationStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new ProximityPlacementGroupProperties(); + } + this.innerProperties().withColocationStatus(colocationStatus); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupProperties.java new file mode 100644 index 0000000000000..663bcf32ca75c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ProximityPlacementGroupProperties.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupType; +import com.azure.resourcemanager.compute.generated.models.SubResourceWithColocationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a Proximity Placement Group. */ +@Fluent +public final class ProximityPlacementGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupProperties.class); + + /* + * Specifies the type of the proximity placement group.

Possible + * values are:

**Standard** : Co-locate resources within an Azure + * region or Availability Zone.

**Ultra** : For future use. + */ + @JsonProperty(value = "proximityPlacementGroupType") + private ProximityPlacementGroupType proximityPlacementGroupType; + + /* + * A list of references to all virtual machines in the proximity placement + * group. + */ + @JsonProperty(value = "virtualMachines", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachines; + + /* + * A list of references to all virtual machine scale sets in the proximity + * placement group. + */ + @JsonProperty(value = "virtualMachineScaleSets", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachineScaleSets; + + /* + * A list of references to all availability sets in the proximity placement + * group. + */ + @JsonProperty(value = "availabilitySets", access = JsonProperty.Access.WRITE_ONLY) + private List availabilitySets; + + /* + * Describes colocation status of the Proximity Placement Group. + */ + @JsonProperty(value = "colocationStatus") + private InstanceViewStatus colocationStatus; + + /** + * Get the proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within an Azure + * region or Availability Zone. <br><br> **Ultra** : For future use. + * + * @return the proximityPlacementGroupType value. + */ + public ProximityPlacementGroupType proximityPlacementGroupType() { + return this.proximityPlacementGroupType; + } + + /** + * Set the proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within an Azure + * region or Availability Zone. <br><br> **Ultra** : For future use. + * + * @param proximityPlacementGroupType the proximityPlacementGroupType value to set. + * @return the ProximityPlacementGroupProperties object itself. + */ + public ProximityPlacementGroupProperties withProximityPlacementGroupType( + ProximityPlacementGroupType proximityPlacementGroupType) { + this.proximityPlacementGroupType = proximityPlacementGroupType; + return this; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the proximity placement group. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Get the virtualMachineScaleSets property: A list of references to all virtual machine scale sets in the proximity + * placement group. + * + * @return the virtualMachineScaleSets value. + */ + public List virtualMachineScaleSets() { + return this.virtualMachineScaleSets; + } + + /** + * Get the availabilitySets property: A list of references to all availability sets in the proximity placement + * group. + * + * @return the availabilitySets value. + */ + public List availabilitySets() { + return this.availabilitySets; + } + + /** + * Get the colocationStatus property: Describes colocation status of the Proximity Placement Group. + * + * @return the colocationStatus value. + */ + public InstanceViewStatus colocationStatus() { + return this.colocationStatus; + } + + /** + * Set the colocationStatus property: Describes colocation status of the Proximity Placement Group. + * + * @param colocationStatus the colocationStatus value to set. + * @return the ProximityPlacementGroupProperties object itself. + */ + public ProximityPlacementGroupProperties withColocationStatus(InstanceViewStatus colocationStatus) { + this.colocationStatus = colocationStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachines() != null) { + virtualMachines().forEach(e -> e.validate()); + } + if (virtualMachineScaleSets() != null) { + virtualMachineScaleSets().forEach(e -> e.validate()); + } + if (availabilitySets() != null) { + availabilitySets().forEach(e -> e.validate()); + } + if (colocationStatus() != null) { + colocationStatus().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RecoveryWalkResponseInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RecoveryWalkResponseInner.java new file mode 100644 index 0000000000000..08f0843b9258e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RecoveryWalkResponseInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response after calling a manual recovery walk. */ +@Immutable +public final class RecoveryWalkResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoveryWalkResponseInner.class); + + /* + * Whether the recovery walk was performed + */ + @JsonProperty(value = "walkPerformed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean walkPerformed; + + /* + * The next update domain that needs to be walked. Null means walk spanning + * all update domains has been completed + */ + @JsonProperty(value = "nextPlatformUpdateDomain", access = JsonProperty.Access.WRITE_ONLY) + private Integer nextPlatformUpdateDomain; + + /** + * Get the walkPerformed property: Whether the recovery walk was performed. + * + * @return the walkPerformed value. + */ + public Boolean walkPerformed() { + return this.walkPerformed; + } + + /** + * Get the nextPlatformUpdateDomain property: The next update domain that needs to be walked. Null means walk + * spanning all update domains has been completed. + * + * @return the nextPlatformUpdateDomain value. + */ + public Integer nextPlatformUpdateDomain() { + return this.nextPlatformUpdateDomain; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ResourceSkuInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ResourceSkuInner.java new file mode 100644 index 0000000000000..5c934cfe0091a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/ResourceSkuInner.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCapabilities; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCapacity; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCosts; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuLocationInfo; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuRestrictions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes an available Compute SKU. */ +@Immutable +public final class ResourceSkuInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuInner.class); + + /* + * The type of resource the SKU applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The name of SKU. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Specifies the tier of virtual machines in a scale set.

+ * Possible Values:

**Standard**

**Basic** + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /* + * The Size of the SKU. + */ + @JsonProperty(value = "size", access = JsonProperty.Access.WRITE_ONLY) + private String size; + + /* + * The Family of this particular SKU. + */ + @JsonProperty(value = "family", access = JsonProperty.Access.WRITE_ONLY) + private String family; + + /* + * The Kind of resources that are supported in this SKU. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Specifies the number of virtual machines in the scale set. + */ + @JsonProperty(value = "capacity", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuCapacity capacity; + + /* + * The set of locations that the SKU is available. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * A list of locations and availability zones in those locations where the + * SKU is available. + */ + @JsonProperty(value = "locationInfo", access = JsonProperty.Access.WRITE_ONLY) + private List locationInfo; + + /* + * The api versions that support this SKU. + */ + @JsonProperty(value = "apiVersions", access = JsonProperty.Access.WRITE_ONLY) + private List apiVersions; + + /* + * Metadata for retrieving price info. + */ + @JsonProperty(value = "costs", access = JsonProperty.Access.WRITE_ONLY) + private List costs; + + /* + * A name value pair to describe the capability. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /* + * The restrictions because of which SKU cannot be used. This is empty if + * there are no restrictions. + */ + @JsonProperty(value = "restrictions", access = JsonProperty.Access.WRITE_ONLY) + private List restrictions; + + /** + * Get the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the name property: The name of SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible + * Values:<br /><br /> **Standard**<br /><br /> **Basic**. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Get the size property: The Size of the SKU. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Get the family property: The Family of this particular SKU. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Get the kind property: The Kind of resources that are supported in this SKU. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the capacity property: Specifies the number of virtual machines in the scale set. + * + * @return the capacity value. + */ + public ResourceSkuCapacity capacity() { + return this.capacity; + } + + /** + * Get the locations property: The set of locations that the SKU is available. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the locationInfo property: A list of locations and availability zones in those locations where the SKU is + * available. + * + * @return the locationInfo value. + */ + public List locationInfo() { + return this.locationInfo; + } + + /** + * Get the apiVersions property: The api versions that support this SKU. + * + * @return the apiVersions value. + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Get the costs property: Metadata for retrieving price info. + * + * @return the costs value. + */ + public List costs() { + return this.costs; + } + + /** + * Get the capabilities property: A name value pair to describe the capability. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Get the restrictions property: The restrictions because of which SKU cannot be used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capacity() != null) { + capacity().validate(); + } + if (locationInfo() != null) { + locationInfo().forEach(e -> e.validate()); + } + if (costs() != null) { + costs().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionInner.java new file mode 100644 index 0000000000000..a33d54e308d32 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Create or update Restore Point collection parameters. */ +@Fluent +public final class RestorePointCollectionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionInner.class); + + /* + * The restore point collection properties. + */ + @JsonProperty(value = "properties") + private RestorePointCollectionProperties innerProperties; + + /** + * Get the innerProperties property: The restore point collection properties. + * + * @return the innerProperties value. + */ + private RestorePointCollectionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public RestorePointCollectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorePointCollectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @return the source value. + */ + public RestorePointCollectionSourceProperties source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @param source the source value to set. + * @return the RestorePointCollectionInner object itself. + */ + public RestorePointCollectionInner withSource(RestorePointCollectionSourceProperties source) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointCollectionProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the restore point collection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the restorePointCollectionId property: The unique id of the restore point collection. + * + * @return the restorePointCollectionId value. + */ + public String restorePointCollectionId() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointCollectionId(); + } + + /** + * Get the restorePoints property: A list containing all restore points created under this restore point collection. + * + * @return the restorePoints value. + */ + public List restorePoints() { + return this.innerProperties() == null ? null : this.innerProperties().restorePoints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionProperties.java new file mode 100644 index 0000000000000..7823a25cac145 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointCollectionProperties.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The restore point collection properties. */ +@Fluent +public final class RestorePointCollectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionProperties.class); + + /* + * The properties of the source resource that this restore point collection + * is created from. + */ + @JsonProperty(value = "source") + private RestorePointCollectionSourceProperties source; + + /* + * The provisioning state of the restore point collection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique id of the restore point collection. + */ + @JsonProperty(value = "restorePointCollectionId", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointCollectionId; + + /* + * A list containing all restore points created under this restore point + * collection. + */ + @JsonProperty(value = "restorePoints", access = JsonProperty.Access.WRITE_ONLY) + private List restorePoints; + + /** + * Get the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @return the source value. + */ + public RestorePointCollectionSourceProperties source() { + return this.source; + } + + /** + * Set the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @param source the source value to set. + * @return the RestorePointCollectionProperties object itself. + */ + public RestorePointCollectionProperties withSource(RestorePointCollectionSourceProperties source) { + this.source = source; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the restore point collection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the restorePointCollectionId property: The unique id of the restore point collection. + * + * @return the restorePointCollectionId value. + */ + public String restorePointCollectionId() { + return this.restorePointCollectionId; + } + + /** + * Get the restorePoints property: A list containing all restore points created under this restore point collection. + * + * @return the restorePoints value. + */ + public List restorePoints() { + return this.restorePoints; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (restorePoints() != null) { + restorePoints().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointInner.java new file mode 100644 index 0000000000000..819f2c6aa3b41 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.ConsistencyModeTypes; +import com.azure.resourcemanager.compute.generated.models.RestorePointInstanceView; +import com.azure.resourcemanager.compute.generated.models.RestorePointSourceMetadata; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Restore Point details. */ +@Fluent +public final class RestorePointInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointInner.class); + + /* + * The restore point properties. + */ + @JsonProperty(value = "properties") + private RestorePointProperties innerProperties; + + /** + * Get the innerProperties property: The restore point properties. + * + * @return the innerProperties value. + */ + private RestorePointProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore + * point. If no disks are specified, all disks will be included. + * + * @return the excludeDisks value. + */ + public List excludeDisks() { + return this.innerProperties() == null ? null : this.innerProperties().excludeDisks(); + } + + /** + * Set the excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore + * point. If no disks are specified, all disks will be included. + * + * @param excludeDisks the excludeDisks value to set. + * @return the RestorePointInner object itself. + */ + public RestorePointInner withExcludeDisks(List excludeDisks) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointProperties(); + } + this.innerProperties().withExcludeDisks(excludeDisks); + return this; + } + + /** + * Get the sourceMetadata property: Gets the details of the VM captured at the time of the restore point creation. + * + * @return the sourceMetadata value. + */ + public RestorePointSourceMetadata sourceMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().sourceMetadata(); + } + + /** + * Get the provisioningState property: Gets the provisioning state of the restore point. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the consistencyMode property: Gets the consistency mode for the restore point. Please refer to + * https://aka.ms/RestorePoints for more details. + * + * @return the consistencyMode value. + */ + public ConsistencyModeTypes consistencyMode() { + return this.innerProperties() == null ? null : this.innerProperties().consistencyMode(); + } + + /** + * Get the timeCreated property: Gets the creation time of the restore point. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Set the timeCreated property: Gets the creation time of the restore point. + * + * @param timeCreated the timeCreated value to set. + * @return the RestorePointInner object itself. + */ + public RestorePointInner withTimeCreated(OffsetDateTime timeCreated) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointProperties(); + } + this.innerProperties().withTimeCreated(timeCreated); + return this; + } + + /** + * Get the sourceRestorePoint property: Resource Id of the source restore point from which a copy needs to be + * created. + * + * @return the sourceRestorePoint value. + */ + public ApiEntityReference sourceRestorePoint() { + return this.innerProperties() == null ? null : this.innerProperties().sourceRestorePoint(); + } + + /** + * Set the sourceRestorePoint property: Resource Id of the source restore point from which a copy needs to be + * created. + * + * @param sourceRestorePoint the sourceRestorePoint value to set. + * @return the RestorePointInner object itself. + */ + public RestorePointInner withSourceRestorePoint(ApiEntityReference sourceRestorePoint) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointProperties(); + } + this.innerProperties().withSourceRestorePoint(sourceRestorePoint); + return this; + } + + /** + * Get the instanceView property: The restore point instance view. + * + * @return the instanceView value. + */ + public RestorePointInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointProperties.java new file mode 100644 index 0000000000000..6b21b65013ee7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RestorePointProperties.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.ConsistencyModeTypes; +import com.azure.resourcemanager.compute.generated.models.RestorePointInstanceView; +import com.azure.resourcemanager.compute.generated.models.RestorePointSourceMetadata; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The restore point properties. */ +@Fluent +public final class RestorePointProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointProperties.class); + + /* + * List of disk resource ids that the customer wishes to exclude from the + * restore point. If no disks are specified, all disks will be included. + */ + @JsonProperty(value = "excludeDisks") + private List excludeDisks; + + /* + * Gets the details of the VM captured at the time of the restore point + * creation. + */ + @JsonProperty(value = "sourceMetadata", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointSourceMetadata sourceMetadata; + + /* + * Gets the provisioning state of the restore point. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Gets the consistency mode for the restore point. Please refer to + * https://aka.ms/RestorePoints for more details. + */ + @JsonProperty(value = "consistencyMode", access = JsonProperty.Access.WRITE_ONLY) + private ConsistencyModeTypes consistencyMode; + + /* + * Gets the creation time of the restore point. + */ + @JsonProperty(value = "timeCreated") + private OffsetDateTime timeCreated; + + /* + * Resource Id of the source restore point from which a copy needs to be + * created. + */ + @JsonProperty(value = "sourceRestorePoint") + private ApiEntityReference sourceRestorePoint; + + /* + * The restore point instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointInstanceView instanceView; + + /** + * Get the excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore + * point. If no disks are specified, all disks will be included. + * + * @return the excludeDisks value. + */ + public List excludeDisks() { + return this.excludeDisks; + } + + /** + * Set the excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore + * point. If no disks are specified, all disks will be included. + * + * @param excludeDisks the excludeDisks value to set. + * @return the RestorePointProperties object itself. + */ + public RestorePointProperties withExcludeDisks(List excludeDisks) { + this.excludeDisks = excludeDisks; + return this; + } + + /** + * Get the sourceMetadata property: Gets the details of the VM captured at the time of the restore point creation. + * + * @return the sourceMetadata value. + */ + public RestorePointSourceMetadata sourceMetadata() { + return this.sourceMetadata; + } + + /** + * Get the provisioningState property: Gets the provisioning state of the restore point. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the consistencyMode property: Gets the consistency mode for the restore point. Please refer to + * https://aka.ms/RestorePoints for more details. + * + * @return the consistencyMode value. + */ + public ConsistencyModeTypes consistencyMode() { + return this.consistencyMode; + } + + /** + * Get the timeCreated property: Gets the creation time of the restore point. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Set the timeCreated property: Gets the creation time of the restore point. + * + * @param timeCreated the timeCreated value to set. + * @return the RestorePointProperties object itself. + */ + public RestorePointProperties withTimeCreated(OffsetDateTime timeCreated) { + this.timeCreated = timeCreated; + return this; + } + + /** + * Get the sourceRestorePoint property: Resource Id of the source restore point from which a copy needs to be + * created. + * + * @return the sourceRestorePoint value. + */ + public ApiEntityReference sourceRestorePoint() { + return this.sourceRestorePoint; + } + + /** + * Set the sourceRestorePoint property: Resource Id of the source restore point from which a copy needs to be + * created. + * + * @param sourceRestorePoint the sourceRestorePoint value to set. + * @return the RestorePointProperties object itself. + */ + public RestorePointProperties withSourceRestorePoint(ApiEntityReference sourceRestorePoint) { + this.sourceRestorePoint = sourceRestorePoint; + return this; + } + + /** + * Get the instanceView property: The restore point instance view. + * + * @return the instanceView value. + */ + public RestorePointInstanceView instanceView() { + return this.instanceView; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (excludeDisks() != null) { + excludeDisks().forEach(e -> e.validate()); + } + if (sourceMetadata() != null) { + sourceMetadata().validate(); + } + if (sourceRestorePoint() != null) { + sourceRestorePoint().validate(); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RetrieveBootDiagnosticsDataResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RetrieveBootDiagnosticsDataResultInner.java new file mode 100644 index 0000000000000..a0a680f735570 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RetrieveBootDiagnosticsDataResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SAS URIs of the console screenshot and serial log blobs. */ +@Immutable +public final class RetrieveBootDiagnosticsDataResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RetrieveBootDiagnosticsDataResultInner.class); + + /* + * The console screenshot blob URI + */ + @JsonProperty(value = "consoleScreenshotBlobUri", access = JsonProperty.Access.WRITE_ONLY) + private String consoleScreenshotBlobUri; + + /* + * The serial console log blob URI. + */ + @JsonProperty(value = "serialConsoleLogBlobUri", access = JsonProperty.Access.WRITE_ONLY) + private String serialConsoleLogBlobUri; + + /** + * Get the consoleScreenshotBlobUri property: The console screenshot blob URI. + * + * @return the consoleScreenshotBlobUri value. + */ + public String consoleScreenshotBlobUri() { + return this.consoleScreenshotBlobUri; + } + + /** + * Get the serialConsoleLogBlobUri property: The serial console log blob URI. + * + * @return the serialConsoleLogBlobUri value. + */ + public String serialConsoleLogBlobUri() { + return this.serialConsoleLogBlobUri; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceInner.java new file mode 100644 index 0000000000000..adfef178856d2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The RoleInstance model. */ +@Fluent +public final class RoleInstanceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstanceInner.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource Name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource Type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Resource Location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private InstanceSku sku; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private RoleInstancePropertiesInner properties; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 location property: Resource Location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public InstanceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @param sku the sku value to set. + * @return the RoleInstanceInner object itself. + */ + public RoleInstanceInner withSku(InstanceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public RoleInstancePropertiesInner properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the RoleInstanceInner object itself. + */ + public RoleInstanceInner withProperties(RoleInstancePropertiesInner properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstancePropertiesInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstancePropertiesInner.java new file mode 100644 index 0000000000000..d910a842f95f8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstancePropertiesInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceNetworkProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The RoleInstanceProperties model. */ +@Fluent +public final class RoleInstancePropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstancePropertiesInner.class); + + /* + * Describes the network profile for the role instance. + */ + @JsonProperty(value = "networkProfile") + private RoleInstanceNetworkProfile networkProfile; + + /* + * The instance view of the role instance. + */ + @JsonProperty(value = "instanceView") + private RoleInstanceViewInner instanceView; + + /** + * Get the networkProfile property: Describes the network profile for the role instance. + * + * @return the networkProfile value. + */ + public RoleInstanceNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Describes the network profile for the role instance. + * + * @param networkProfile the networkProfile value to set. + * @return the RoleInstancePropertiesInner object itself. + */ + public RoleInstancePropertiesInner withNetworkProfile(RoleInstanceNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the instanceView property: The instance view of the role instance. + * + * @return the instanceView value. + */ + public RoleInstanceViewInner instanceView() { + return this.instanceView; + } + + /** + * Set the instanceView property: The instance view of the role instance. + * + * @param instanceView the instanceView value to set. + * @return the RoleInstancePropertiesInner object itself. + */ + public RoleInstancePropertiesInner withInstanceView(RoleInstanceViewInner instanceView) { + this.instanceView = instanceView; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkProfile() != null) { + networkProfile().validate(); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceViewInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceViewInner.java new file mode 100644 index 0000000000000..ad997bb66968c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RoleInstanceViewInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ResourceInstanceViewStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of the role instance. */ +@Immutable +public final class RoleInstanceViewInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstanceViewInner.class); + + /* + * The Update Domain. + */ + @JsonProperty(value = "platformUpdateDomain", access = JsonProperty.Access.WRITE_ONLY) + private Integer platformUpdateDomain; + + /* + * The Fault Domain. + */ + @JsonProperty(value = "platformFaultDomain", access = JsonProperty.Access.WRITE_ONLY) + private Integer platformFaultDomain; + + /* + * Specifies a unique identifier generated internally for the cloud service + * associated with this role instance.

NOTE: If you are using + * Azure Diagnostics extension, this property can be used as 'DeploymentId' + * for querying details. + */ + @JsonProperty(value = "privateId", access = JsonProperty.Access.WRITE_ONLY) + private String privateId; + + /* + * The statuses property. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /** + * Get the platformUpdateDomain property: The Update Domain. + * + * @return the platformUpdateDomain value. + */ + public Integer platformUpdateDomain() { + return this.platformUpdateDomain; + } + + /** + * Get the platformFaultDomain property: The Fault Domain. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.platformFaultDomain; + } + + /** + * Get the privateId property: Specifies a unique identifier generated internally for the cloud service associated + * with this role instance. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this + * property can be used as 'DeploymentId' for querying details. + * + * @return the privateId value. + */ + public String privateId() { + return this.privateId; + } + + /** + * Get the statuses property: The statuses property. + * + * @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()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoInner.java new file mode 100644 index 0000000000000..532ca9bc40b0a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeProgressInfo; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeRunningStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The status of the latest virtual machine scale set rolling upgrade. */ +@Fluent +public final class RollingUpgradeStatusInfoInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollingUpgradeStatusInfoInner.class); + + /* + * The status of the latest virtual machine scale set rolling upgrade. + */ + @JsonProperty(value = "properties") + private RollingUpgradeStatusInfoProperties innerProperties; + + /** + * Get the innerProperties property: The status of the latest virtual machine scale set rolling upgrade. + * + * @return the innerProperties value. + */ + private RollingUpgradeStatusInfoProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public RollingUpgradeStatusInfoInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RollingUpgradeStatusInfoInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the policy property: The rolling upgrade policies applied for this upgrade. + * + * @return the policy value. + */ + public RollingUpgradePolicy policy() { + return this.innerProperties() == null ? null : this.innerProperties().policy(); + } + + /** + * Get the runningStatus property: Information about the current running state of the overall upgrade. + * + * @return the runningStatus value. + */ + public RollingUpgradeRunningStatus runningStatus() { + return this.innerProperties() == null ? null : this.innerProperties().runningStatus(); + } + + /** + * Get the progress property: Information about the number of virtual machine instances in each upgrade state. + * + * @return the progress value. + */ + public RollingUpgradeProgressInfo progress() { + return this.innerProperties() == null ? null : this.innerProperties().progress(); + } + + /** + * Get the error property: Error details for this upgrade, if there are any. + * + * @return the error value. + */ + public ApiError error() { + return this.innerProperties() == null ? null : this.innerProperties().error(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoProperties.java new file mode 100644 index 0000000000000..0f4100376269d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RollingUpgradeStatusInfoProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeProgressInfo; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeRunningStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status of the latest virtual machine scale set rolling upgrade. */ +@Immutable +public final class RollingUpgradeStatusInfoProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollingUpgradeStatusInfoProperties.class); + + /* + * The rolling upgrade policies applied for this upgrade. + */ + @JsonProperty(value = "policy", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradePolicy policy; + + /* + * Information about the current running state of the overall upgrade. + */ + @JsonProperty(value = "runningStatus", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeRunningStatus runningStatus; + + /* + * Information about the number of virtual machine instances in each + * upgrade state. + */ + @JsonProperty(value = "progress", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeProgressInfo progress; + + /* + * Error details for this upgrade, if there are any. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Get the policy property: The rolling upgrade policies applied for this upgrade. + * + * @return the policy value. + */ + public RollingUpgradePolicy policy() { + return this.policy; + } + + /** + * Get the runningStatus property: Information about the current running state of the overall upgrade. + * + * @return the runningStatus value. + */ + public RollingUpgradeRunningStatus runningStatus() { + return this.runningStatus; + } + + /** + * Get the progress property: Information about the number of virtual machine instances in each upgrade state. + * + * @return the progress value. + */ + public RollingUpgradeProgressInfo progress() { + return this.progress; + } + + /** + * Get the error property: Error details for this upgrade, if there are any. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policy() != null) { + policy().validate(); + } + if (runningStatus() != null) { + runningStatus().validate(); + } + if (progress() != null) { + progress().validate(); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentBaseInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentBaseInner.java new file mode 100644 index 0000000000000..08a70b8292c9b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentBaseInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Run Command metadata. */ +@Fluent +public class RunCommandDocumentBaseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandDocumentBaseInner.class); + + /* + * The VM run command schema. + */ + @JsonProperty(value = "$schema", required = true) + private String schema; + + /* + * The VM run command id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The Operating System type. + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemTypes osType; + + /* + * The VM run command label. + */ + @JsonProperty(value = "label", required = true) + private String label; + + /* + * The VM run command description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * Get the schema property: The VM run command schema. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: The VM run command schema. + * + * @param schema the schema value to set. + * @return the RunCommandDocumentBaseInner object itself. + */ + public RunCommandDocumentBaseInner withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the id property: The VM run command id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The VM run command id. + * + * @param id the id value to set. + * @return the RunCommandDocumentBaseInner object itself. + */ + public RunCommandDocumentBaseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: The Operating System type. + * + * @param osType the osType value to set. + * @return the RunCommandDocumentBaseInner object itself. + */ + public RunCommandDocumentBaseInner withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the label property: The VM run command label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: The VM run command label. + * + * @param label the label value to set. + * @return the RunCommandDocumentBaseInner object itself. + */ + public RunCommandDocumentBaseInner withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the description property: The VM run command description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The VM run command description. + * + * @param description the description value to set. + * @return the RunCommandDocumentBaseInner object itself. + */ + public RunCommandDocumentBaseInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schema() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schema in model RunCommandDocumentBaseInner")); + } + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model RunCommandDocumentBaseInner")); + } + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osType in model RunCommandDocumentBaseInner")); + } + if (label() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property label in model RunCommandDocumentBaseInner")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model RunCommandDocumentBaseInner")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentInner.java new file mode 100644 index 0000000000000..091365d0c34a0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandDocumentInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandParameterDefinition; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a Run Command. */ +@Fluent +public final class RunCommandDocumentInner extends RunCommandDocumentBaseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandDocumentInner.class); + + /* + * The script to be executed. + */ + @JsonProperty(value = "script", required = true) + private List script; + + /* + * The parameters used by the script. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * Get the script property: The script to be executed. + * + * @return the script value. + */ + public List script() { + return this.script; + } + + /** + * Set the script property: The script to be executed. + * + * @param script the script value to set. + * @return the RunCommandDocumentInner object itself. + */ + public RunCommandDocumentInner withScript(List script) { + this.script = script; + return this; + } + + /** + * Get the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters used by the script. + * + * @param parameters the parameters value to set. + * @return the RunCommandDocumentInner object itself. + */ + public RunCommandDocumentInner withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** {@inheritDoc} */ + @Override + public RunCommandDocumentInner withSchema(String schema) { + super.withSchema(schema); + return this; + } + + /** {@inheritDoc} */ + @Override + public RunCommandDocumentInner withId(String id) { + super.withId(id); + return this; + } + + /** {@inheritDoc} */ + @Override + public RunCommandDocumentInner withOsType(OperatingSystemTypes osType) { + super.withOsType(osType); + return this; + } + + /** {@inheritDoc} */ + @Override + public RunCommandDocumentInner withLabel(String label) { + super.withLabel(label); + return this; + } + + /** {@inheritDoc} */ + @Override + public RunCommandDocumentInner withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (script() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property script in model RunCommandDocumentInner")); + } + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandResultInner.java new file mode 100644 index 0000000000000..f500f75596159 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/RunCommandResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The RunCommandResult model. */ +@Fluent +public final class RunCommandResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandResultInner.class); + + /* + * Run command operation response. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Run command operation response. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Run command operation response. + * + * @param value the value value to set. + * @return the RunCommandResultInner object itself. + */ + public RunCommandResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryIdentifier.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryIdentifier.java new file mode 100644 index 0000000000000..ed5f5fe16de3b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryIdentifier.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The identifier information of shared gallery. */ +@Fluent +public final class SharedGalleryIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryIdentifier.class); + + /* + * The unique id of this shared gallery. + */ + @JsonProperty(value = "uniqueId") + private String uniqueId; + + /** + * Get the uniqueId property: The unique id of this shared gallery. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Set the uniqueId property: The unique id of this shared gallery. + * + * @param uniqueId the uniqueId value to set. + * @return the SharedGalleryIdentifier object itself. + */ + public SharedGalleryIdentifier withUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageInner.java new file mode 100644 index 0000000000000..26333f91af514 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageInner.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PirSharedGalleryResource; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Specifies information about the gallery image definition that you want to create or update. */ +@Fluent +public final class SharedGalleryImageInner extends PirSharedGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageInner.class); + + /* + * Describes the properties of a gallery image definition. + */ + @JsonProperty(value = "properties") + private SharedGalleryImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image definition. + * + * @return the innerProperties value. + */ + private SharedGalleryImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SharedGalleryImageInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.innerProperties() == null ? null : this.innerProperties().osState(); + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withOsState(OperatingSystemStateTypes osState) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withOsState(osState); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withIdentifier(GalleryImageIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.innerProperties() == null ? null : this.innerProperties().recommended(); + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withRecommended(RecommendedMachineConfiguration recommended) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withRecommended(recommended); + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.innerProperties() == null ? null : this.innerProperties().disallowed(); + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withDisallowed(Disallowed disallowed) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withDisallowed(disallowed); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.innerProperties() == null ? null : this.innerProperties().features(); + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withFeatures(List features) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withFeatures(features); + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the SharedGalleryImageInner object itself. + */ + public SharedGalleryImageInner withPurchasePlan(ImagePurchasePlan purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageProperties.java new file mode 100644 index 0000000000000..08fb07d7467d6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageProperties.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the properties of a gallery image definition. */ +@Fluent +public final class SharedGalleryImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageProperties.class); + + /* + * This property allows you to specify the type of the OS that is included + * in the disk when creating a VM from a managed image.

Possible + * values are:

**Windows**

**Linux** + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemTypes osType; + + /* + * This property allows the user to specify whether the virtual machines + * created under this image are 'Generalized' or 'Specialized'. + */ + @JsonProperty(value = "osState", required = true) + private OperatingSystemStateTypes osState; + + /* + * The end of life date of the gallery image definition. This property can + * be used for decommissioning purposes. This property is updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /* + * This is the gallery image definition identifier. + */ + @JsonProperty(value = "identifier", required = true) + private GalleryImageIdentifier identifier; + + /* + * The properties describe the recommended machine configuration for this + * Image Definition. These properties are updatable. + */ + @JsonProperty(value = "recommended") + private RecommendedMachineConfiguration recommended; + + /* + * Describes the disallowed disk types. + */ + @JsonProperty(value = "disallowed") + private Disallowed disallowed; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * A list of gallery image features. + */ + @JsonProperty(value = "features") + private List features; + + /* + * Describes the gallery image definition purchase plan. This is used by + * marketplace images. + */ + @JsonProperty(value = "purchasePlan") + private ImagePurchasePlan purchasePlan; + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **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 when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.osState; + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withOsState(OperatingSystemStateTypes osState) { + this.osState = osState; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + 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 SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withIdentifier(GalleryImageIdentifier identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.recommended; + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withRecommended(RecommendedMachineConfiguration recommended) { + this.recommended = recommended; + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.disallowed; + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withDisallowed(Disallowed disallowed) { + this.disallowed = disallowed; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.features; + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the SharedGalleryImageProperties object itself. + */ + public SharedGalleryImageProperties withPurchasePlan(ImagePurchasePlan purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osType in model SharedGalleryImageProperties")); + } + if (osState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osState in model SharedGalleryImageProperties")); + } + if (identifier() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property identifier in model SharedGalleryImageProperties")); + } else { + identifier().validate(); + } + if (recommended() != null) { + recommended().validate(); + } + if (disallowed() != null) { + disallowed().validate(); + } + if (features() != null) { + features().forEach(e -> e.validate()); + } + if (purchasePlan() != null) { + purchasePlan().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionInner.java new file mode 100644 index 0000000000000..66c27153583a6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PirSharedGalleryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Specifies information about the gallery image version that you want to create or update. */ +@Fluent +public final class SharedGalleryImageVersionInner extends PirSharedGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageVersionInner.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private SharedGalleryImageVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private SharedGalleryImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SharedGalleryImageVersionInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Get the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.innerProperties() == null ? null : this.innerProperties().publishedDate(); + } + + /** + * Set the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param publishedDate the publishedDate value to set. + * @return the SharedGalleryImageVersionInner object itself. + */ + public SharedGalleryImageVersionInner withPublishedDate(OffsetDateTime publishedDate) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageVersionProperties(); + } + this.innerProperties().withPublishedDate(publishedDate); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the SharedGalleryImageVersionInner object itself. + */ + public SharedGalleryImageVersionInner withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new SharedGalleryImageVersionProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionProperties.java new file mode 100644 index 0000000000000..1a97fad11dc4a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryImageVersionProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of a gallery image version. */ +@Fluent +public final class SharedGalleryImageVersionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageVersionProperties.class); + + /* + * The published date of the gallery image version Definition. This + * property can be used for decommissioning purposes. This property is + * updatable. + */ + @JsonProperty(value = "publishedDate") + private OffsetDateTime publishedDate; + + /* + * The end of life date of the gallery image version Definition. This + * property can be used for decommissioning purposes. This property is + * updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /** + * Get the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.publishedDate; + } + + /** + * Set the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param publishedDate the publishedDate value to set. + * @return the SharedGalleryImageVersionProperties object itself. + */ + public SharedGalleryImageVersionProperties withPublishedDate(OffsetDateTime publishedDate) { + this.publishedDate = publishedDate; + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the SharedGalleryImageVersionProperties object itself. + */ + public SharedGalleryImageVersionProperties withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryInner.java new file mode 100644 index 0000000000000..25f78fbf37061 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharedGalleryInner.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.PirSharedGalleryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Specifies information about the Shared Gallery that you want to create or update. */ +@Fluent +public final class SharedGalleryInner extends PirSharedGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryInner.class); + + /** {@inheritDoc} */ + @Override + public SharedGalleryInner withUniqueId(String uniqueId) { + super.withUniqueId(uniqueId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharingUpdateInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharingUpdateInner.java new file mode 100644 index 0000000000000..6e643d8d317ba --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SharingUpdateInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroup; +import com.azure.resourcemanager.compute.generated.models.SharingUpdateOperationTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies information about the gallery sharing profile update. */ +@Fluent +public final class SharingUpdateInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharingUpdateInner.class); + + /* + * This property allows you to specify the operation type of gallery + * sharing update.

Possible values are:

**Add**

+ * **Remove**

**Reset** + */ + @JsonProperty(value = "operationType", required = true) + private SharingUpdateOperationTypes operationType; + + /* + * A list of sharing profile groups. + */ + @JsonProperty(value = "groups") + private List groups; + + /** + * Get the operationType property: This property allows you to specify the operation type of gallery sharing update. + * <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** + * <br><br> **Reset**. + * + * @return the operationType value. + */ + public SharingUpdateOperationTypes operationType() { + return this.operationType; + } + + /** + * Set the operationType property: This property allows you to specify the operation type of gallery sharing update. + * <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** + * <br><br> **Reset**. + * + * @param operationType the operationType value to set. + * @return the SharingUpdateInner object itself. + */ + public SharingUpdateInner withOperationType(SharingUpdateOperationTypes operationType) { + this.operationType = operationType; + return this; + } + + /** + * Get the groups property: A list of sharing profile groups. + * + * @return the groups value. + */ + public List groups() { + return this.groups; + } + + /** + * Set the groups property: A list of sharing profile groups. + * + * @param groups the groups value to set. + * @return the SharingUpdateInner object itself. + */ + public SharingUpdateInner withGroups(List groups) { + this.groups = groups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operationType in model SharingUpdateInner")); + } + if (groups() != null) { + groups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotInner.java new file mode 100644 index 0000000000000..f5fba6e126d01 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotInner.java @@ -0,0 +1,565 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SnapshotSku; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Snapshot resource. */ +@Fluent +public final class SnapshotInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotInner.class); + + /* + * Unused. Always Null. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /* + * The snapshots sku name. Can be Standard_LRS, Premium_LRS, or + * Standard_ZRS. This is an optional parameter for incremental snapshot and + * the default behavior is the SKU will be set to the same sku as the + * previous snapshot + */ + @JsonProperty(value = "sku") + private SnapshotSku sku; + + /* + * The extended location where the snapshot will be created. Extended + * location cannot be changed. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * Snapshot resource properties. + */ + @JsonProperty(value = "properties") + private SnapshotProperties innerProperties; + + /** + * Get the managedBy property: Unused. Always Null. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an + * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * + * @return the sku value. + */ + public SnapshotSku sku() { + return this.sku; + } + + /** + * Set the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an + * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * + * @param sku the sku value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withSku(SnapshotSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the extendedLocation property: The extended location where the snapshot will be created. Extended location + * cannot be changed. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location where the snapshot will be created. Extended location + * cannot be changed. + * + * @param extendedLocation the extendedLocation value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the innerProperties property: Snapshot resource properties. + * + * @return the innerProperties value. + */ + private SnapshotProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SnapshotInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SnapshotInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the timeCreated property: The time when the snapshot was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: The Operating System type. + * + * @param osType the osType value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the image from which the source disk for the + * snapshot was originally created. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Purchase plan information for the image from which the source disk for the + * snapshot was originally created. + * + * @param purchasePlan the purchasePlan value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities(); + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withSupportedCapabilities(supportedCapabilities); + return this; + } + + /** + * Get the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @return the creationData value. + */ + public CreationData creationData() { + return this.innerProperties() == null ? null : this.innerProperties().creationData(); + } + + /** + * Set the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @param creationData the creationData value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withCreationData(CreationData creationData) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withCreationData(creationData); + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeGB(); + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withDiskSizeGB(Integer diskSizeGB) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withDiskSizeGB(diskSizeGB); + return this; + } + + /** + * Get the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + public Long diskSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeBytes(); + } + + /** + * Get the diskState property: The state of the snapshot. + * + * @return the diskState value. + */ + public DiskState diskState() { + return this.innerProperties() == null ? null : this.innerProperties().diskState(); + } + + /** + * Get the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerProperties() == null ? null : this.innerProperties().uniqueId(); + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionSettingsCollection(); + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + + /** + * Get the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy + * less space than full snapshots and can be diffed. + * + * @return the incremental value. + */ + public Boolean incremental() { + return this.innerProperties() == null ? null : this.innerProperties().incremental(); + } + + /** + * Set the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy + * less space than full snapshots and can be diffed. + * + * @param incremental the incremental value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withIncremental(Boolean incremental) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withIncremental(incremental); + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withEncryption(Encryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy(); + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.innerProperties() == null ? null : this.innerProperties().diskAccessId(); + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withDiskAccessId(String diskAccessId) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withDiskAccessId(diskAccessId); + return this; + } + + /** + * Get the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + public DiskSecurityProfile securityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().securityProfile(); + } + + /** + * Set the securityProfile property: Contains the security related information for the resource. + * + * @param securityProfile the securityProfile value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withSecurityProfile(DiskSecurityProfile securityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withSecurityProfile(securityProfile); + return this; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation(); + } + + /** + * Set the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withSupportsHibernation(Boolean supportsHibernation) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withSupportsHibernation(supportsHibernation); + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.innerProperties() == null ? null : this.innerProperties().completionPercent(); + } + + /** + * Set the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @param completionPercent the completionPercent value to set. + * @return the SnapshotInner object itself. + */ + public SnapshotInner withCompletionPercent(Float completionPercent) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotProperties(); + } + this.innerProperties().withCompletionPercent(completionPercent); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotProperties.java new file mode 100644 index 0000000000000..05c1e8511eb17 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotProperties.java @@ -0,0 +1,557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Snapshot resource properties. */ +@Fluent +public final class SnapshotProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotProperties.class); + + /* + * The time when the snapshot was created. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /* + * The Operating System type. + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGeneration hyperVGeneration; + + /* + * Purchase plan information for the image from which the source disk for + * the snapshot was originally created. + */ + @JsonProperty(value = "purchasePlan") + private PurchasePlanAutoGenerated purchasePlan; + + /* + * List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally + * created. + */ + @JsonProperty(value = "supportedCapabilities") + private SupportedCapabilities supportedCapabilities; + + /* + * Disk source information. CreationData information cannot be changed + * after the disk has been created. + */ + @JsonProperty(value = "creationData", required = true) + private CreationData creationData; + + /* + * If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for + * updates or creation with other options, it indicates a resize. Resizes + * are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The size of the disk in bytes. This field is read only. + */ + @JsonProperty(value = "diskSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long diskSizeBytes; + + /* + * The state of the snapshot. + */ + @JsonProperty(value = "diskState", access = JsonProperty.Access.WRITE_ONLY) + private DiskState diskState; + + /* + * Unique Guid identifying the resource. + */ + @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueId; + + /* + * Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + */ + @JsonProperty(value = "encryptionSettingsCollection") + private EncryptionSettingsCollection encryptionSettingsCollection; + + /* + * The disk provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Whether a snapshot is incremental. Incremental snapshots on the same + * disk occupy less space than full snapshots and can be diffed. + */ + @JsonProperty(value = "incremental") + private Boolean incremental; + + /* + * Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys. + */ + @JsonProperty(value = "encryption") + private Encryption encryption; + + /* + * Policy for accessing the disk via network. + */ + @JsonProperty(value = "networkAccessPolicy") + private NetworkAccessPolicy networkAccessPolicy; + + /* + * ARM id of the DiskAccess resource for using private endpoints on disks. + */ + @JsonProperty(value = "diskAccessId") + private String diskAccessId; + + /* + * Contains the security related information for the resource. + */ + @JsonProperty(value = "securityProfile") + private DiskSecurityProfile securityProfile; + + /* + * Indicates the OS on a snapshot supports hibernation. + */ + @JsonProperty(value = "supportsHibernation") + private Boolean supportsHibernation; + + /* + * Policy for controlling export on the disk. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * Percentage complete for the background copy when a resource is created + * via the CopyStart operation. + */ + @JsonProperty(value = "completionPercent") + private Float completionPercent; + + /** + * Get the timeCreated property: The time when the snapshot was created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Get the osType property: The Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: The Operating System type. + * + * @param osType the osType value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information for the image from which the source disk for the + * snapshot was originally created. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.purchasePlan; + } + + /** + * Set the purchasePlan property: Purchase plan information for the image from which the source disk for the + * snapshot was originally created. + * + * @param purchasePlan the purchasePlan value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + this.purchasePlan = purchasePlan; + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.supportedCapabilities; + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + this.supportedCapabilities = supportedCapabilities; + return this; + } + + /** + * Get the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @return the creationData value. + */ + public CreationData creationData() { + return this.creationData; + } + + /** + * Set the creationData property: Disk source information. CreationData information cannot be changed after the disk + * has been created. + * + * @param creationData the creationData value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withCreationData(CreationData creationData) { + this.creationData = creationData; + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + public Long diskSizeBytes() { + return this.diskSizeBytes; + } + + /** + * Get the diskState property: The state of the snapshot. + * + * @return the diskState value. + */ + public DiskState diskState() { + return this.diskState; + } + + /** + * Get the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.encryptionSettingsCollection; + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withEncryptionSettingsCollection( + EncryptionSettingsCollection encryptionSettingsCollection) { + this.encryptionSettingsCollection = encryptionSettingsCollection; + return this; + } + + /** + * Get the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy + * less space than full snapshots and can be diffed. + * + * @return the incremental value. + */ + public Boolean incremental() { + return this.incremental; + } + + /** + * Set the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy + * less space than full snapshots and can be diffed. + * + * @param incremental the incremental value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withIncremental(Boolean incremental) { + this.incremental = incremental; + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.networkAccessPolicy; + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + this.networkAccessPolicy = networkAccessPolicy; + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.diskAccessId; + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withDiskAccessId(String diskAccessId) { + this.diskAccessId = diskAccessId; + return this; + } + + /** + * Get the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + public DiskSecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Contains the security related information for the resource. + * + * @param securityProfile the securityProfile value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withSecurityProfile(DiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.supportsHibernation; + } + + /** + * Set the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withSupportsHibernation(Boolean supportsHibernation) { + this.supportsHibernation = supportsHibernation; + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + public Float completionPercent() { + return this.completionPercent; + } + + /** + * Set the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @param completionPercent the completionPercent value to set. + * @return the SnapshotProperties object itself. + */ + public SnapshotProperties withCompletionPercent(Float completionPercent) { + this.completionPercent = completionPercent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (purchasePlan() != null) { + purchasePlan().validate(); + } + if (supportedCapabilities() != null) { + supportedCapabilities().validate(); + } + if (creationData() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property creationData in model SnapshotProperties")); + } else { + creationData().validate(); + } + if (encryptionSettingsCollection() != null) { + encryptionSettingsCollection().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotUpdateProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotUpdateProperties.java new file mode 100644 index 0000000000000..d8c3e31b9e1b5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SnapshotUpdateProperties.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Snapshot resource update properties. */ +@Fluent +public final class SnapshotUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotUpdateProperties.class); + + /* + * the Operating System type. + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for + * updates or creation with other options, it indicates a resize. Resizes + * are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + */ + @JsonProperty(value = "encryptionSettingsCollection") + private EncryptionSettingsCollection encryptionSettingsCollection; + + /* + * Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys. + */ + @JsonProperty(value = "encryption") + private Encryption encryption; + + /* + * Policy for accessing the disk via network. + */ + @JsonProperty(value = "networkAccessPolicy") + private NetworkAccessPolicy networkAccessPolicy; + + /* + * ARM id of the DiskAccess resource for using private endpoints on disks. + */ + @JsonProperty(value = "diskAccessId") + private String diskAccessId; + + /* + * Indicates the OS on a snapshot supports hibernation. + */ + @JsonProperty(value = "supportsHibernation") + private Boolean supportsHibernation; + + /* + * Policy for controlling export on the disk. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + */ + @JsonProperty(value = "supportedCapabilities") + private SupportedCapabilities supportedCapabilities; + + /** + * Get the osType property: the Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: the Operating System type. + * + * @param osType the osType value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.encryptionSettingsCollection; + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withEncryptionSettingsCollection( + EncryptionSettingsCollection encryptionSettingsCollection) { + this.encryptionSettingsCollection = encryptionSettingsCollection; + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.networkAccessPolicy; + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + this.networkAccessPolicy = networkAccessPolicy; + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.diskAccessId; + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withDiskAccessId(String diskAccessId) { + this.diskAccessId = diskAccessId; + return this; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.supportsHibernation; + } + + /** + * Set the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withSupportsHibernation(Boolean supportsHibernation) { + this.supportsHibernation = supportsHibernation; + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.supportedCapabilities; + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the SnapshotUpdateProperties object itself. + */ + public SnapshotUpdateProperties withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + this.supportedCapabilities = supportedCapabilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettingsCollection() != null) { + encryptionSettingsCollection().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (supportedCapabilities() != null) { + supportedCapabilities().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyGenerateKeyPairResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyGenerateKeyPairResultInner.java new file mode 100644 index 0000000000000..c642df87a4dc3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyGenerateKeyPairResultInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response from generation of an SSH key pair. */ +@Fluent +public final class SshPublicKeyGenerateKeyPairResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeyGenerateKeyPairResultInner.class); + + /* + * Private key portion of the key pair used to authenticate to a virtual + * machine through ssh. The private key is returned in RFC3447 format and + * should be treated as a secret. + */ + @JsonProperty(value = "privateKey", required = true) + private String privateKey; + + /* + * Public key portion of the key pair used to authenticate to a virtual + * machine through ssh. The public key is in ssh-rsa format. + */ + @JsonProperty(value = "publicKey", required = true) + private String publicKey; + + /* + * The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the privateKey property: Private key portion of the key pair used to authenticate to a virtual machine + * through ssh. The private key is returned in RFC3447 format and should be treated as a secret. + * + * @return the privateKey value. + */ + public String privateKey() { + return this.privateKey; + } + + /** + * Set the privateKey property: Private key portion of the key pair used to authenticate to a virtual machine + * through ssh. The private key is returned in RFC3447 format and should be treated as a secret. + * + * @param privateKey the privateKey value to set. + * @return the SshPublicKeyGenerateKeyPairResultInner object itself. + */ + public SshPublicKeyGenerateKeyPairResultInner withPrivateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get the publicKey property: Public key portion of the key pair used to authenticate to a virtual machine through + * ssh. The public key is in ssh-rsa format. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Set the publicKey property: Public key portion of the key pair used to authenticate to a virtual machine through + * ssh. The public key is in ssh-rsa format. + * + * @param publicKey the publicKey value to set. + * @return the SshPublicKeyGenerateKeyPairResultInner object itself. + */ + public SshPublicKeyGenerateKeyPairResultInner withPublicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Get the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + * + * @param id the id value to set. + * @return the SshPublicKeyGenerateKeyPairResultInner object itself. + */ + public SshPublicKeyGenerateKeyPairResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateKey in model SshPublicKeyGenerateKeyPairResultInner")); + } + if (publicKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publicKey in model SshPublicKeyGenerateKeyPairResultInner")); + } + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model SshPublicKeyGenerateKeyPairResultInner")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceInner.java new file mode 100644 index 0000000000000..c556c7e9a1cb3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the SSH public key. */ +@Fluent +public final class SshPublicKeyResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeyResourceInner.class); + + /* + * Properties of the SSH public key. + */ + @JsonProperty(value = "properties") + private SshPublicKeyResourceProperties innerProperties; + + /** + * Get the innerProperties property: Properties of the SSH public key. + * + * @return the innerProperties value. + */ + private SshPublicKeyResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SshPublicKeyResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SshPublicKeyResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.innerProperties() == null ? null : this.innerProperties().publicKey(); + } + + /** + * Set the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @param publicKey the publicKey value to set. + * @return the SshPublicKeyResourceInner object itself. + */ + public SshPublicKeyResourceInner withPublicKey(String publicKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SshPublicKeyResourceProperties(); + } + this.innerProperties().withPublicKey(publicKey); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceProperties.java new file mode 100644 index 0000000000000..0cba8c8398f2d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/SshPublicKeyResourceProperties.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the SSH public key. */ +@Fluent +public final class SshPublicKeyResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeyResourceProperties.class); + + /* + * SSH public key used to authenticate to a virtual machine through ssh. If + * this property is not initially provided when the resource is created, + * the publicKey property will be populated when generateKeyPair is called. + * If the public key is provided upon resource creation, the provided + * public key needs to be at least 2048-bit and in ssh-rsa format. + */ + @JsonProperty(value = "publicKey") + private String publicKey; + + /** + * Get the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Set the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @param publicKey the publicKey value to set. + * @return the SshPublicKeyResourceProperties object itself. + */ + public SshPublicKeyResourceProperties withPublicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpdateDomainInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpdateDomainInner.java new file mode 100644 index 0000000000000..94b6a54474039 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpdateDomainInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines an update domain for the cloud service. */ +@Immutable +public final class UpdateDomainInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateDomainInner.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource Name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Resource Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpgradeOperationHistoricalStatusInfoInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpgradeOperationHistoricalStatusInfoInner.java new file mode 100644 index 0000000000000..67adc2e566e68 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UpgradeOperationHistoricalStatusInfoInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.UpgradeOperationHistoricalStatusInfoProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual Machine Scale Set OS Upgrade History operation response. */ +@Immutable +public final class UpgradeOperationHistoricalStatusInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpgradeOperationHistoricalStatusInfoInner.class); + + /* + * Information about the properties of the upgrade operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private UpgradeOperationHistoricalStatusInfoProperties properties; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Resource location + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the properties property: Information about the properties of the upgrade operation. + * + * @return the properties value. + */ + public UpgradeOperationHistoricalStatusInfoProperties properties() { + return this.properties; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UsageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..6ad308e3a5884 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/UsageInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.UsageName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes Compute Resource Usage. */ +@Fluent +public final class UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageInner.class); + + /* + * An enum describing the unit of usage measurement. + */ + @JsonProperty(value = "unit", required = true) + private String unit = "Count"; + + /* + * The current usage of the resource. + */ + @JsonProperty(value = "currentValue", required = true) + private int currentValue; + + /* + * The maximum permitted usage of the resource. + */ + @JsonProperty(value = "limit", required = true) + private long limit; + + /* + * The name of the type of usage. + */ + @JsonProperty(value = "name", required = true) + private UsageName name; + + /** Creates an instance of UsageInner class. */ + public UsageInner() { + unit = "Count"; + } + + /** + * Get the unit property: An enum describing the unit of usage measurement. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: An enum describing the unit of usage measurement. + * + * @param unit the unit value to set. + * @return the UsageInner object itself. + */ + public UsageInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the currentValue property: The current usage of the resource. + * + * @return the currentValue value. + */ + public int currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: The current usage of the resource. + * + * @param currentValue the currentValue value to set. + * @return the UsageInner object itself. + */ + public UsageInner withCurrentValue(int currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the limit property: The maximum permitted usage of the resource. + * + * @return the limit value. + */ + public long limit() { + return this.limit; + } + + /** + * Set the limit property: The maximum permitted usage of the resource. + * + * @param limit the limit value to set. + * @return the UsageInner object itself. + */ + public UsageInner withLimit(long limit) { + this.limit = limit; + return this; + } + + /** + * Get the name property: The name of the type of usage. + * + * @return the name value. + */ + public UsageName name() { + return this.name; + } + + /** + * Set the name property: The name of the type of usage. + * + * @param name the name value to set. + * @return the UsageInner object itself. + */ + public UsageInner withName(UsageName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model UsageInner")); + } else { + name().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineAssessPatchesResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineAssessPatchesResultInner.java new file mode 100644 index 0000000000000..f4cec98529c22 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineAssessPatchesResultInner.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.PatchOperationStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSoftwarePatchProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the properties of an AssessPatches result. */ +@Immutable +public final class VirtualMachineAssessPatchesResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineAssessPatchesResultInner.class); + + /* + * The overall success or failure status of the operation. It remains + * "InProgress" until the operation completes. At that point it will become + * "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings." + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private PatchOperationStatus status; + + /* + * The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + */ + @JsonProperty(value = "assessmentActivityId", access = JsonProperty.Access.WRITE_ONLY) + private String assessmentActivityId; + + /* + * The overall reboot status of the VM. It will be true when partially + * installed patches require a reboot to complete installation but the + * reboot has not yet occurred. + */ + @JsonProperty(value = "rebootPending", access = JsonProperty.Access.WRITE_ONLY) + private Boolean rebootPending; + + /* + * The number of critical or security patches that have been detected as + * available and not yet installed. + */ + @JsonProperty(value = "criticalAndSecurityPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer criticalAndSecurityPatchCount; + + /* + * The number of all available patches excluding critical and security. + */ + @JsonProperty(value = "otherPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer otherPatchCount; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDateTime; + + /* + * The list of patches that have been detected as available for + * installation. + */ + @JsonProperty(value = "availablePatches", access = JsonProperty.Access.WRITE_ONLY) + private List availablePatches; + + /* + * The errors that were encountered during execution of the operation. The + * details array contains the list of them. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Get the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + public PatchOperationStatus status() { + return this.status; + } + + /** + * Get the assessmentActivityId property: The activity ID of the operation that produced this result. It is used to + * correlate across CRP and extension logs. + * + * @return the assessmentActivityId value. + */ + public String assessmentActivityId() { + return this.assessmentActivityId; + } + + /** + * Get the rebootPending property: The overall reboot status of the VM. It will be true when partially installed + * patches require a reboot to complete installation but the reboot has not yet occurred. + * + * @return the rebootPending value. + */ + public Boolean rebootPending() { + return this.rebootPending; + } + + /** + * Get the criticalAndSecurityPatchCount property: The number of critical or security patches that have been + * detected as available and not yet installed. + * + * @return the criticalAndSecurityPatchCount value. + */ + public Integer criticalAndSecurityPatchCount() { + return this.criticalAndSecurityPatchCount; + } + + /** + * Get the otherPatchCount property: The number of all available patches excluding critical and security. + * + * @return the otherPatchCount value. + */ + public Integer otherPatchCount() { + return this.otherPatchCount; + } + + /** + * Get the startDateTime property: The UTC timestamp when the operation began. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Get the availablePatches property: The list of patches that have been detected as available for installation. + * + * @return the availablePatches value. + */ + public List availablePatches() { + return this.availablePatches; + } + + /** + * Get the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availablePatches() != null) { + availablePatches().forEach(e -> e.validate()); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineCaptureResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineCaptureResultInner.java new file mode 100644 index 0000000000000..c4ea1f230a136 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineCaptureResultInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Output of virtual machine capture operation. */ +@Fluent +public final class VirtualMachineCaptureResultInner extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineCaptureResultInner.class); + + /* + * the schema of the captured virtual machine + */ + @JsonProperty(value = "$schema", access = JsonProperty.Access.WRITE_ONLY) + private String schema; + + /* + * the version of the content + */ + @JsonProperty(value = "contentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String contentVersion; + + /* + * parameters of the captured virtual machine + */ + @JsonProperty(value = "parameters", access = JsonProperty.Access.WRITE_ONLY) + private Object parameters; + + /* + * a list of resource items of the captured virtual machine + */ + @JsonProperty(value = "resources", access = JsonProperty.Access.WRITE_ONLY) + private List resources; + + /** + * Get the schema property: the schema of the captured virtual machine. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Get the contentVersion property: the version of the content. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Get the parameters property: parameters of the captured virtual machine. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Get the resources property: a list of resource items of the captured virtual machine. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineCaptureResultInner withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageInner.java new file mode 100644 index 0000000000000..47cfb637c1428 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Virtual Machine Extension Image. */ +@Fluent +public final class VirtualMachineExtensionImageInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionImageInner.class); + + /* + * Describes the properties of a Virtual Machine Extension Image. + */ + @JsonProperty(value = "properties") + private VirtualMachineExtensionImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Extension Image. + * + * @return the innerProperties value. + */ + private VirtualMachineExtensionImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineExtensionImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineExtensionImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the operatingSystem property: The operating system this extension supports. + * + * @return the operatingSystem value. + */ + public String operatingSystem() { + return this.innerProperties() == null ? null : this.innerProperties().operatingSystem(); + } + + /** + * Set the operatingSystem property: The operating system this extension supports. + * + * @param operatingSystem the operatingSystem value to set. + * @return the VirtualMachineExtensionImageInner object itself. + */ + public VirtualMachineExtensionImageInner withOperatingSystem(String operatingSystem) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionImageProperties(); + } + this.innerProperties().withOperatingSystem(operatingSystem); + return this; + } + + /** + * Get the computeRole property: The type of role (IaaS or PaaS) this extension supports. + * + * @return the computeRole value. + */ + public String computeRole() { + return this.innerProperties() == null ? null : this.innerProperties().computeRole(); + } + + /** + * Set the computeRole property: The type of role (IaaS or PaaS) this extension supports. + * + * @param computeRole the computeRole value to set. + * @return the VirtualMachineExtensionImageInner object itself. + */ + public VirtualMachineExtensionImageInner withComputeRole(String computeRole) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionImageProperties(); + } + this.innerProperties().withComputeRole(computeRole); + return this; + } + + /** + * Get the handlerSchema property: The schema defined by publisher, where extension consumers should provide + * settings in a matching schema. + * + * @return the handlerSchema value. + */ + public String handlerSchema() { + return this.innerProperties() == null ? null : this.innerProperties().handlerSchema(); + } + + /** + * Set the handlerSchema property: The schema defined by publisher, where extension consumers should provide + * settings in a matching schema. + * + * @param handlerSchema the handlerSchema value to set. + * @return the VirtualMachineExtensionImageInner object itself. + */ + public VirtualMachineExtensionImageInner withHandlerSchema(String handlerSchema) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionImageProperties(); + } + this.innerProperties().withHandlerSchema(handlerSchema); + return this; + } + + /** + * Get the vmScaleSetEnabled property: Whether the extension can be used on xRP VMScaleSets. By default existing + * extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the + * extension is only enabled for CRP VMs but not VMSS. + * + * @return the vmScaleSetEnabled value. + */ + public Boolean vmScaleSetEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().vmScaleSetEnabled(); + } + + /** + * Set the vmScaleSetEnabled property: Whether the extension can be used on xRP VMScaleSets. By default existing + * extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the + * extension is only enabled for CRP VMs but not VMSS. + * + * @param vmScaleSetEnabled the vmScaleSetEnabled value to set. + * @return the VirtualMachineExtensionImageInner object itself. + */ + public VirtualMachineExtensionImageInner withVmScaleSetEnabled(Boolean vmScaleSetEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionImageProperties(); + } + this.innerProperties().withVmScaleSetEnabled(vmScaleSetEnabled); + return this; + } + + /** + * Get the supportsMultipleExtensions property: Whether the handler can support multiple extensions. + * + * @return the supportsMultipleExtensions value. + */ + public Boolean supportsMultipleExtensions() { + return this.innerProperties() == null ? null : this.innerProperties().supportsMultipleExtensions(); + } + + /** + * Set the supportsMultipleExtensions property: Whether the handler can support multiple extensions. + * + * @param supportsMultipleExtensions the supportsMultipleExtensions value to set. + * @return the VirtualMachineExtensionImageInner object itself. + */ + public VirtualMachineExtensionImageInner withSupportsMultipleExtensions(Boolean supportsMultipleExtensions) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionImageProperties(); + } + this.innerProperties().withSupportsMultipleExtensions(supportsMultipleExtensions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageProperties.java new file mode 100644 index 0000000000000..714d1fed1bbbc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionImageProperties.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Virtual Machine Extension Image. */ +@Fluent +public final class VirtualMachineExtensionImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionImageProperties.class); + + /* + * The operating system this extension supports. + */ + @JsonProperty(value = "operatingSystem", required = true) + private String operatingSystem; + + /* + * The type of role (IaaS or PaaS) this extension supports. + */ + @JsonProperty(value = "computeRole", required = true) + private String computeRole; + + /* + * The schema defined by publisher, where extension consumers should + * provide settings in a matching schema. + */ + @JsonProperty(value = "handlerSchema", required = true) + private String handlerSchema; + + /* + * Whether the extension can be used on xRP VMScaleSets. By default + * existing extensions are usable on scalesets, but there might be cases + * where a publisher wants to explicitly indicate the extension is only + * enabled for CRP VMs but not VMSS. + */ + @JsonProperty(value = "vmScaleSetEnabled") + private Boolean vmScaleSetEnabled; + + /* + * Whether the handler can support multiple extensions. + */ + @JsonProperty(value = "supportsMultipleExtensions") + private Boolean supportsMultipleExtensions; + + /** + * Get the operatingSystem property: The operating system this extension supports. + * + * @return the operatingSystem value. + */ + public String operatingSystem() { + return this.operatingSystem; + } + + /** + * Set the operatingSystem property: The operating system this extension supports. + * + * @param operatingSystem the operatingSystem value to set. + * @return the VirtualMachineExtensionImageProperties object itself. + */ + public VirtualMachineExtensionImageProperties withOperatingSystem(String operatingSystem) { + this.operatingSystem = operatingSystem; + return this; + } + + /** + * Get the computeRole property: The type of role (IaaS or PaaS) this extension supports. + * + * @return the computeRole value. + */ + public String computeRole() { + return this.computeRole; + } + + /** + * Set the computeRole property: The type of role (IaaS or PaaS) this extension supports. + * + * @param computeRole the computeRole value to set. + * @return the VirtualMachineExtensionImageProperties object itself. + */ + public VirtualMachineExtensionImageProperties withComputeRole(String computeRole) { + this.computeRole = computeRole; + return this; + } + + /** + * Get the handlerSchema property: The schema defined by publisher, where extension consumers should provide + * settings in a matching schema. + * + * @return the handlerSchema value. + */ + public String handlerSchema() { + return this.handlerSchema; + } + + /** + * Set the handlerSchema property: The schema defined by publisher, where extension consumers should provide + * settings in a matching schema. + * + * @param handlerSchema the handlerSchema value to set. + * @return the VirtualMachineExtensionImageProperties object itself. + */ + public VirtualMachineExtensionImageProperties withHandlerSchema(String handlerSchema) { + this.handlerSchema = handlerSchema; + return this; + } + + /** + * Get the vmScaleSetEnabled property: Whether the extension can be used on xRP VMScaleSets. By default existing + * extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the + * extension is only enabled for CRP VMs but not VMSS. + * + * @return the vmScaleSetEnabled value. + */ + public Boolean vmScaleSetEnabled() { + return this.vmScaleSetEnabled; + } + + /** + * Set the vmScaleSetEnabled property: Whether the extension can be used on xRP VMScaleSets. By default existing + * extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the + * extension is only enabled for CRP VMs but not VMSS. + * + * @param vmScaleSetEnabled the vmScaleSetEnabled value to set. + * @return the VirtualMachineExtensionImageProperties object itself. + */ + public VirtualMachineExtensionImageProperties withVmScaleSetEnabled(Boolean vmScaleSetEnabled) { + this.vmScaleSetEnabled = vmScaleSetEnabled; + return this; + } + + /** + * Get the supportsMultipleExtensions property: Whether the handler can support multiple extensions. + * + * @return the supportsMultipleExtensions value. + */ + public Boolean supportsMultipleExtensions() { + return this.supportsMultipleExtensions; + } + + /** + * Set the supportsMultipleExtensions property: Whether the handler can support multiple extensions. + * + * @param supportsMultipleExtensions the supportsMultipleExtensions value to set. + * @return the VirtualMachineExtensionImageProperties object itself. + */ + public VirtualMachineExtensionImageProperties withSupportsMultipleExtensions(Boolean supportsMultipleExtensions) { + this.supportsMultipleExtensions = supportsMultipleExtensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operatingSystem() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operatingSystem in model VirtualMachineExtensionImageProperties")); + } + if (computeRole() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property computeRole in model VirtualMachineExtensionImageProperties")); + } + if (handlerSchema() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property handlerSchema in model VirtualMachineExtensionImageProperties")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionInner.java new file mode 100644 index 0000000000000..d41175bbe487c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionInner.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Virtual Machine Extension. */ +@Fluent +public final class VirtualMachineExtensionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionInner.class); + + /* + * Describes the properties of a Virtual Machine Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineExtensionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineExtensionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineExtensionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine extension instance view. + * + * @return the instanceView value. + */ + public VirtualMachineExtensionInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Set the instanceView property: The virtual machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withInstanceView(VirtualMachineExtensionInstanceView instanceView) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withInstanceView(instanceView); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineExtensionInner object itself. + */ + public VirtualMachineExtensionInner withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionProperties.java new file mode 100644 index 0000000000000..69f20d3dd3f56 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionProperties.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Virtual Machine Extension. */ +@Fluent +public final class VirtualMachineExtensionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionProperties.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + */ + @JsonProperty(value = "enableAutomaticUpgrade") + private Boolean enableAutomaticUpgrade; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The virtual machine extension instance view. + */ + @JsonProperty(value = "instanceView") + private VirtualMachineExtensionInstanceView instanceView; + + /* + * Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will + * not be suppressed regardless of this value). The default is false. + */ + @JsonProperty(value = "suppressFailures") + private Boolean suppressFailures; + + /* + * The extensions protected settings that are passed by reference, and + * consumed from key vault + */ + @JsonProperty(value = "protectedSettingsFromKeyVault") + private Object protectedSettingsFromKeyVault; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.enableAutomaticUpgrade; + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + this.enableAutomaticUpgrade = enableAutomaticUpgrade; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The virtual machine extension instance view. + * + * @return the instanceView value. + */ + public VirtualMachineExtensionInstanceView instanceView() { + return this.instanceView; + } + + /** + * Set the instanceView property: The virtual machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withInstanceView(VirtualMachineExtensionInstanceView instanceView) { + this.instanceView = instanceView; + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.suppressFailures; + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withSuppressFailures(Boolean suppressFailures) { + this.suppressFailures = suppressFailures; + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.protectedSettingsFromKeyVault; + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineExtensionProperties object itself. + */ + public VirtualMachineExtensionProperties withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault) { + this.protectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionUpdateProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionUpdateProperties.java new file mode 100644 index 0000000000000..91f130548c94f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionUpdateProperties.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Virtual Machine Extension. */ +@Fluent +public final class VirtualMachineExtensionUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionUpdateProperties.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + */ + @JsonProperty(value = "enableAutomaticUpgrade") + private Boolean enableAutomaticUpgrade; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will + * not be suppressed regardless of this value). The default is false. + */ + @JsonProperty(value = "suppressFailures") + private Boolean suppressFailures; + + /* + * The extensions protected settings that are passed by reference, and + * consumed from key vault + */ + @JsonProperty(value = "protectedSettingsFromKeyVault") + private Object protectedSettingsFromKeyVault; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.enableAutomaticUpgrade; + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + this.enableAutomaticUpgrade = enableAutomaticUpgrade; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.suppressFailures; + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withSuppressFailures(Boolean suppressFailures) { + this.suppressFailures = suppressFailures; + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.protectedSettingsFromKeyVault; + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineExtensionUpdateProperties object itself. + */ + public VirtualMachineExtensionUpdateProperties withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + this.protectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionsListResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionsListResultInner.java new file mode 100644 index 0000000000000..31a6799c5f641 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineExtensionsListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Extension operation response. */ +@Fluent +public final class VirtualMachineExtensionsListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionsListResultInner.class); + + /* + * The list of extensions + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of extensions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of extensions. + * + * @param value the value value to set. + * @return the VirtualMachineExtensionsListResultInner object itself. + */ + public VirtualMachineExtensionsListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageInner.java new file mode 100644 index 0000000000000..4250da8b2d96d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageInner.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AutomaticOSUpgradeProperties; +import com.azure.resourcemanager.compute.generated.models.DataDiskImage; +import com.azure.resourcemanager.compute.generated.models.DisallowedConfiguration; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.OSDiskImage; +import com.azure.resourcemanager.compute.generated.models.PurchasePlan; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageFeature; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine Image. */ +@Fluent +public final class VirtualMachineImageInner extends VirtualMachineImageResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImageInner.class); + + /* + * Describes the properties of a Virtual Machine Image. + */ + @JsonProperty(value = "properties") + private VirtualMachineImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Image. + * + * @return the innerProperties value. + */ + private VirtualMachineImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageInner withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageInner withExtendedLocation(ExtendedLocation extendedLocation) { + super.withExtendedLocation(extendedLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageInner withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the plan property: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + * + * @return the plan value. + */ + public PurchasePlan plan() { + return this.innerProperties() == null ? null : this.innerProperties().plan(); + } + + /** + * Set the plan property: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + * + * @param plan the plan value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withPlan(PurchasePlan plan) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withPlan(plan); + return this; + } + + /** + * Get the osDiskImage property: Contains the os disk image information. + * + * @return the osDiskImage value. + */ + public OSDiskImage osDiskImage() { + return this.innerProperties() == null ? null : this.innerProperties().osDiskImage(); + } + + /** + * Set the osDiskImage property: Contains the os disk image information. + * + * @param osDiskImage the osDiskImage value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withOsDiskImage(OSDiskImage osDiskImage) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withOsDiskImage(osDiskImage); + return this; + } + + /** + * Get the dataDiskImages property: The dataDiskImages property. + * + * @return the dataDiskImages value. + */ + public List dataDiskImages() { + return this.innerProperties() == null ? null : this.innerProperties().dataDiskImages(); + } + + /** + * Set the dataDiskImages property: The dataDiskImages property. + * + * @param dataDiskImages the dataDiskImages value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withDataDiskImages(List dataDiskImages) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withDataDiskImages(dataDiskImages); + return this; + } + + /** + * Get the automaticOSUpgradeProperties property: Describes automatic OS upgrade properties on the image. + * + * @return the automaticOSUpgradeProperties value. + */ + public AutomaticOSUpgradeProperties automaticOSUpgradeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().automaticOSUpgradeProperties(); + } + + /** + * Set the automaticOSUpgradeProperties property: Describes automatic OS upgrade properties on the image. + * + * @param automaticOSUpgradeProperties the automaticOSUpgradeProperties value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withAutomaticOSUpgradeProperties( + AutomaticOSUpgradeProperties automaticOSUpgradeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withAutomaticOSUpgradeProperties(automaticOSUpgradeProperties); + return this; + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGeneration Type. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationTypes hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGeneration Type. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the disallowed property: Specifies disallowed configuration for the VirtualMachine created from the image. + * + * @return the disallowed value. + */ + public DisallowedConfiguration disallowed() { + return this.innerProperties() == null ? null : this.innerProperties().disallowed(); + } + + /** + * Set the disallowed property: Specifies disallowed configuration for the VirtualMachine created from the image. + * + * @param disallowed the disallowed value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withDisallowed(DisallowedConfiguration disallowed) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withDisallowed(disallowed); + return this; + } + + /** + * Get the features property: The features property. + * + * @return the features value. + */ + public List features() { + return this.innerProperties() == null ? null : this.innerProperties().features(); + } + + /** + * Set the features property: The features property. + * + * @param features the features value to set. + * @return the VirtualMachineImageInner object itself. + */ + public VirtualMachineImageInner withFeatures(List features) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineImageProperties(); + } + this.innerProperties().withFeatures(features); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageProperties.java new file mode 100644 index 0000000000000..3a2f40d621318 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageProperties.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AutomaticOSUpgradeProperties; +import com.azure.resourcemanager.compute.generated.models.DataDiskImage; +import com.azure.resourcemanager.compute.generated.models.DisallowedConfiguration; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.OSDiskImage; +import com.azure.resourcemanager.compute.generated.models.PurchasePlan; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageFeature; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a Virtual Machine Image. */ +@Fluent +public final class VirtualMachineImageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImageProperties.class); + + /* + * Used for establishing the purchase context of any 3rd Party artifact + * through MarketPlace. + */ + @JsonProperty(value = "plan") + private PurchasePlan plan; + + /* + * Contains the os disk image information. + */ + @JsonProperty(value = "osDiskImage") + private OSDiskImage osDiskImage; + + /* + * The dataDiskImages property. + */ + @JsonProperty(value = "dataDiskImages") + private List dataDiskImages; + + /* + * Describes automatic OS upgrade properties on the image. + */ + @JsonProperty(value = "automaticOSUpgradeProperties") + private AutomaticOSUpgradeProperties automaticOSUpgradeProperties; + + /* + * Specifies the HyperVGeneration Type + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGenerationTypes hyperVGeneration; + + /* + * Specifies disallowed configuration for the VirtualMachine created from + * the image + */ + @JsonProperty(value = "disallowed") + private DisallowedConfiguration disallowed; + + /* + * The features property. + */ + @JsonProperty(value = "features") + private List features; + + /** + * Get the plan property: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + * + * @return the plan value. + */ + public PurchasePlan plan() { + return this.plan; + } + + /** + * Set the plan property: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + * + * @param plan the plan value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withPlan(PurchasePlan plan) { + this.plan = plan; + return this; + } + + /** + * Get the osDiskImage property: Contains the os disk image information. + * + * @return the osDiskImage value. + */ + public OSDiskImage osDiskImage() { + return this.osDiskImage; + } + + /** + * Set the osDiskImage property: Contains the os disk image information. + * + * @param osDiskImage the osDiskImage value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withOsDiskImage(OSDiskImage osDiskImage) { + this.osDiskImage = osDiskImage; + return this; + } + + /** + * Get the dataDiskImages property: The dataDiskImages property. + * + * @return the dataDiskImages value. + */ + public List dataDiskImages() { + return this.dataDiskImages; + } + + /** + * Set the dataDiskImages property: The dataDiskImages property. + * + * @param dataDiskImages the dataDiskImages value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withDataDiskImages(List dataDiskImages) { + this.dataDiskImages = dataDiskImages; + return this; + } + + /** + * Get the automaticOSUpgradeProperties property: Describes automatic OS upgrade properties on the image. + * + * @return the automaticOSUpgradeProperties value. + */ + public AutomaticOSUpgradeProperties automaticOSUpgradeProperties() { + return this.automaticOSUpgradeProperties; + } + + /** + * Set the automaticOSUpgradeProperties property: Describes automatic OS upgrade properties on the image. + * + * @param automaticOSUpgradeProperties the automaticOSUpgradeProperties value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withAutomaticOSUpgradeProperties( + AutomaticOSUpgradeProperties automaticOSUpgradeProperties) { + this.automaticOSUpgradeProperties = automaticOSUpgradeProperties; + return this; + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGeneration Type. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationTypes hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGeneration Type. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the disallowed property: Specifies disallowed configuration for the VirtualMachine created from the image. + * + * @return the disallowed value. + */ + public DisallowedConfiguration disallowed() { + return this.disallowed; + } + + /** + * Set the disallowed property: Specifies disallowed configuration for the VirtualMachine created from the image. + * + * @param disallowed the disallowed value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withDisallowed(DisallowedConfiguration disallowed) { + this.disallowed = disallowed; + return this; + } + + /** + * Get the features property: The features property. + * + * @return the features value. + */ + public List features() { + return this.features; + } + + /** + * Set the features property: The features property. + * + * @param features the features value to set. + * @return the VirtualMachineImageProperties object itself. + */ + public VirtualMachineImageProperties withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (plan() != null) { + plan().validate(); + } + if (osDiskImage() != null) { + osDiskImage().validate(); + } + if (dataDiskImages() != null) { + dataDiskImages().forEach(e -> e.validate()); + } + if (automaticOSUpgradeProperties() != null) { + automaticOSUpgradeProperties().validate(); + } + if (disallowed() != null) { + disallowed().validate(); + } + if (features() != null) { + features().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageResourceInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageResourceInner.java new file mode 100644 index 0000000000000..be4330e1f4478 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineImageResourceInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Virtual machine image resource information. */ +@Fluent +public class VirtualMachineImageResourceInner extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImageResourceInner.class); + + /* + * The name of the resource. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The supported Azure location of the resource. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Specifies the tags that are assigned to the virtual machine. For more + * information about using tags, see [Using tags to organize your Azure + * resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The extended location of the Virtual Machine. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource. + * + * @param name the name value to set. + * @return the VirtualMachineImageResourceInner object itself. + */ + public VirtualMachineImageResourceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: The supported Azure location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The supported Azure location of the resource. + * + * @param location the location value to set. + * @return the VirtualMachineImageResourceInner object itself. + */ + public VirtualMachineImageResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Specifies the tags that are assigned to the virtual machine. For more information about + * using tags, see [Using tags to organize your Azure + * resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Specifies the tags that are assigned to the virtual machine. For more information about + * using tags, see [Using tags to organize your Azure + * resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + * + * @param tags the tags value to set. + * @return the VirtualMachineImageResourceInner object itself. + */ + public VirtualMachineImageResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the extendedLocation property: The extended location of the Virtual Machine. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location of the Virtual Machine. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualMachineImageResourceInner object itself. + */ + public VirtualMachineImageResourceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineImageResourceInner withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineImageResourceInner")); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model VirtualMachineImageResourceInner")); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInner.java new file mode 100644 index 0000000000000..753278ce2fd9f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInner.java @@ -0,0 +1,856 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine. */ +@Fluent +public final class VirtualMachineInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineInner.class); + + /* + * Specifies information about the marketplace image used to create the + * virtual machine. This element is only used for marketplace images. + * Before you can use a marketplace image from an API, you must enable the + * image for programmatic use. In the Azure portal, find the marketplace + * image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information and + * then click **Save**. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * Describes the properties of a Virtual Machine. + */ + @JsonProperty(value = "properties") + private VirtualMachinePropertiesInner innerProperties; + + /* + * The virtual machine child extension resources. + */ + @JsonProperty(value = "resources", access = JsonProperty.Access.WRITE_ONLY) + private List resources; + + /* + * The identity of the virtual machine, if configured. + */ + @JsonProperty(value = "identity") + private VirtualMachineIdentity identity; + + /* + * The virtual machine zones. + */ + @JsonProperty(value = "zones") + private List zones; + + /* + * The extended location of the Virtual Machine. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @param plan the plan value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine. + * + * @return the innerProperties value. + */ + private VirtualMachinePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the resources property: The virtual machine child extension resources. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Get the identity property: The identity of the virtual machine, if configured. + * + * @return the identity value. + */ + public VirtualMachineIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the virtual machine, if configured. + * + * @param identity the identity value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withIdentity(VirtualMachineIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the zones property: The virtual machine zones. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The virtual machine zones. + * + * @param zones the zones value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the extendedLocation property: The extended location of the Virtual Machine. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location of the Virtual Machine. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile(); + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withHardwareProfile(HardwareProfile hardwareProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHardwareProfile(hardwareProfile); + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withStorageProfile(StorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities(); + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withAdditionalCapabilities(additionalCapabilities); + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.innerProperties() == null ? null : this.innerProperties().osProfile(); + } + + /** + * Set the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withOsProfile(OSProfile osProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withOsProfile(osProfile); + return this; + } + + /** + * Get the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfile(); + } + + /** + * Set the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withNetworkProfile(NetworkProfile networkProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withNetworkProfile(networkProfile); + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().securityProfile(); + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withSecurityProfile(SecurityProfile securityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withSecurityProfile(securityProfile); + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticsProfile(); + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withDiagnosticsProfile(diagnosticsProfile); + return this; + } + + /** + * Get the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + public SubResource availabilitySet() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySet(); + } + + /** + * Set the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @param availabilitySet the availabilitySet value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withAvailabilitySet(SubResource availabilitySet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withAvailabilitySet(availabilitySet); + return this; + } + + /** + * Get the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + public SubResource virtualMachineScaleSet() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineScaleSet(); + } + + /** + * Set the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @param virtualMachineScaleSet the virtualMachineScaleSet value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withVirtualMachineScaleSet(SubResource virtualMachineScaleSet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withVirtualMachineScaleSet(virtualMachineScaleSet); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Get the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + public VirtualMachinePriorityTypes priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @param priority the priority value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withPriority(VirtualMachinePriorityTypes priority) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * Get the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().evictionPolicy(); + } + + /** + * Set the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @param evictionPolicy the evictionPolicy value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withEvictionPolicy(evictionPolicy); + return this; + } + + /** + * Get the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + public BillingProfile billingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().billingProfile(); + } + + /** + * Set the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param billingProfile the billingProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withBillingProfile(BillingProfile billingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withBillingProfile(billingProfile); + return this; + } + + /** + * Get the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + public SubResource host() { + return this.innerProperties() == null ? null : this.innerProperties().host(); + } + + /** + * Set the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @param host the host value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withHost(SubResource host) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHost(host); + return this; + } + + /** + * Get the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @return the hostGroup value. + */ + public SubResource hostGroup() { + return this.innerProperties() == null ? null : this.innerProperties().hostGroup(); + } + + /** + * Set the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @param hostGroup the hostGroup value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withHostGroup(SubResource hostGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHostGroup(hostGroup); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineInstanceViewInner instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withLicenseType(String licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + public String vmId() { + return this.innerProperties() == null ? null : this.innerProperties().vmId(); + } + + /** + * Get the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + public String extensionsTimeBudget() { + return this.innerProperties() == null ? null : this.innerProperties().extensionsTimeBudget(); + } + + /** + * Set the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @param extensionsTimeBudget the extensionsTimeBudget value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withExtensionsTimeBudget(String extensionsTimeBudget) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withExtensionsTimeBudget(extensionsTimeBudget); + return this; + } + + /** + * Get the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomain(); + } + + /** + * Set the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withPlatformFaultDomain(Integer platformFaultDomain) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withPlatformFaultDomain(platformFaultDomain); + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().scheduledEventsProfile(); + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withScheduledEventsProfile(scheduledEventsProfile); + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.innerProperties() == null ? null : this.innerProperties().userData(); + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withUserData(String userData) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withUserData(userData); + return this; + } + + /** + * Get the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + public CapacityReservationProfile capacityReservation() { + return this.innerProperties() == null ? null : this.innerProperties().capacityReservation(); + } + + /** + * Set the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @param capacityReservation the capacityReservation value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withCapacityReservation(CapacityReservationProfile capacityReservation) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withCapacityReservation(capacityReservation); + return this; + } + + /** + * Get the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + public ApplicationProfile applicationProfile() { + return this.innerProperties() == null ? null : this.innerProperties().applicationProfile(); + } + + /** + * Set the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param applicationProfile the applicationProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withApplicationProfile(ApplicationProfile applicationProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withApplicationProfile(applicationProfile); + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (plan() != null) { + plan().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (resources() != null) { + resources().forEach(e -> e.validate()); + } + if (identity() != null) { + identity().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstallPatchesResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstallPatchesResultInner.java new file mode 100644 index 0000000000000..42e5443fc59dc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstallPatchesResultInner.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.PatchInstallationDetail; +import com.azure.resourcemanager.compute.generated.models.PatchOperationStatus; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchRebootStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The result summary of an installation operation. */ +@Immutable +public final class VirtualMachineInstallPatchesResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineInstallPatchesResultInner.class); + + /* + * The overall success or failure status of the operation. It remains + * "InProgress" until the operation completes. At that point it will become + * "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings." + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private PatchOperationStatus status; + + /* + * The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + */ + @JsonProperty(value = "installationActivityId", access = JsonProperty.Access.WRITE_ONLY) + private String installationActivityId; + + /* + * The reboot state of the VM following completion of the operation. + */ + @JsonProperty(value = "rebootStatus", access = JsonProperty.Access.WRITE_ONLY) + private VMGuestPatchRebootStatus rebootStatus; + + /* + * Whether the operation ran out of time before it completed all its + * intended actions. + */ + @JsonProperty(value = "maintenanceWindowExceeded", access = JsonProperty.Access.WRITE_ONLY) + private Boolean maintenanceWindowExceeded; + + /* + * The number of patches that were not installed due to the user blocking + * their installation. + */ + @JsonProperty(value = "excludedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer excludedPatchCount; + + /* + * The number of patches that were detected as available for install, but + * did not meet the operation's criteria. + */ + @JsonProperty(value = "notSelectedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer notSelectedPatchCount; + + /* + * The number of patches that were identified as meeting the installation + * criteria, but were not able to be installed. Typically this happens when + * maintenanceWindowExceeded == true. + */ + @JsonProperty(value = "pendingPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer pendingPatchCount; + + /* + * The number of patches successfully installed. + */ + @JsonProperty(value = "installedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer installedPatchCount; + + /* + * The number of patches that could not be installed due to some issue. See + * errors for details. + */ + @JsonProperty(value = "failedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedPatchCount; + + /* + * The patches that were installed during the operation. + */ + @JsonProperty(value = "patches", access = JsonProperty.Access.WRITE_ONLY) + private List patches; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDateTime; + + /* + * The errors that were encountered during execution of the operation. The + * details array contains the list of them. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Get the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + public PatchOperationStatus status() { + return this.status; + } + + /** + * Get the installationActivityId property: The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + * + * @return the installationActivityId value. + */ + public String installationActivityId() { + return this.installationActivityId; + } + + /** + * Get the rebootStatus property: The reboot state of the VM following completion of the operation. + * + * @return the rebootStatus value. + */ + public VMGuestPatchRebootStatus rebootStatus() { + return this.rebootStatus; + } + + /** + * Get the maintenanceWindowExceeded property: Whether the operation ran out of time before it completed all its + * intended actions. + * + * @return the maintenanceWindowExceeded value. + */ + public Boolean maintenanceWindowExceeded() { + return this.maintenanceWindowExceeded; + } + + /** + * Get the excludedPatchCount property: The number of patches that were not installed due to the user blocking their + * installation. + * + * @return the excludedPatchCount value. + */ + public Integer excludedPatchCount() { + return this.excludedPatchCount; + } + + /** + * Get the notSelectedPatchCount property: The number of patches that were detected as available for install, but + * did not meet the operation's criteria. + * + * @return the notSelectedPatchCount value. + */ + public Integer notSelectedPatchCount() { + return this.notSelectedPatchCount; + } + + /** + * Get the pendingPatchCount property: The number of patches that were identified as meeting the installation + * criteria, but were not able to be installed. Typically this happens when maintenanceWindowExceeded == true. + * + * @return the pendingPatchCount value. + */ + public Integer pendingPatchCount() { + return this.pendingPatchCount; + } + + /** + * Get the installedPatchCount property: The number of patches successfully installed. + * + * @return the installedPatchCount value. + */ + public Integer installedPatchCount() { + return this.installedPatchCount; + } + + /** + * Get the failedPatchCount property: The number of patches that could not be installed due to some issue. See + * errors for details. + * + * @return the failedPatchCount value. + */ + public Integer failedPatchCount() { + return this.failedPatchCount; + } + + /** + * Get the patches property: The patches that were installed during the operation. + * + * @return the patches value. + */ + public List patches() { + return this.patches; + } + + /** + * Get the startDateTime property: The UTC timestamp when the operation began. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Get the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (patches() != null) { + patches().forEach(e -> e.validate()); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstanceViewInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstanceViewInner.java new file mode 100644 index 0000000000000..30ea8b1a98403 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineInstanceViewInner.java @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.BootDiagnosticsInstanceView; +import com.azure.resourcemanager.compute.generated.models.DiskInstanceView; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationType; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.MaintenanceRedeployStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAgentInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineHealthStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePatchStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a virtual machine. */ +@Fluent +public final class VirtualMachineInstanceViewInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineInstanceViewInner.class); + + /* + * Specifies the update domain of the virtual machine. + */ + @JsonProperty(value = "platformUpdateDomain") + private Integer platformUpdateDomain; + + /* + * Specifies the fault domain of the virtual machine. + */ + @JsonProperty(value = "platformFaultDomain") + private Integer platformFaultDomain; + + /* + * The computer name assigned to the virtual machine. + */ + @JsonProperty(value = "computerName") + private String computerName; + + /* + * The Operating System running on the virtual machine. + */ + @JsonProperty(value = "osName") + private String osName; + + /* + * The version of Operating System running on the virtual machine. + */ + @JsonProperty(value = "osVersion") + private String osVersion; + + /* + * Specifies the HyperVGeneration Type associated with a resource + */ + @JsonProperty(value = "hyperVGeneration") + private HyperVGenerationType hyperVGeneration; + + /* + * The Remote desktop certificate thumbprint. + */ + @JsonProperty(value = "rdpThumbPrint") + private String rdpThumbPrint; + + /* + * The VM Agent running on the virtual machine. + */ + @JsonProperty(value = "vmAgent") + private VirtualMachineAgentInstanceView vmAgent; + + /* + * The Maintenance Operation status on the virtual machine. + */ + @JsonProperty(value = "maintenanceRedeployStatus") + private MaintenanceRedeployStatus maintenanceRedeployStatus; + + /* + * The virtual machine disk information. + */ + @JsonProperty(value = "disks") + private List disks; + + /* + * The extensions information. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /* + * The health status for the VM. + */ + @JsonProperty(value = "vmHealth", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineHealthStatus vmHealth; + + /* + * Boot Diagnostics is a debugging feature which allows you to view Console + * Output and Screenshot to diagnose VM status.

You can easily + * view the output of your console log.

Azure also enables you to + * see a screenshot of the VM from the hypervisor. + */ + @JsonProperty(value = "bootDiagnostics") + private BootDiagnosticsInstanceView bootDiagnostics; + + /* + * Resource id of the dedicated host, on which the virtual machine is + * allocated through automatic placement, when the virtual machine is + * associated with a dedicated host group that has automatic placement + * enabled.

Minimum api-version: 2020-06-01. + */ + @JsonProperty(value = "assignedHost", access = JsonProperty.Access.WRITE_ONLY) + private String assignedHost; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /* + * [Preview Feature] The status of virtual machine patch operations. + */ + @JsonProperty(value = "patchStatus") + private VirtualMachinePatchStatus patchStatus; + + /** + * Get the platformUpdateDomain property: Specifies the update domain of the virtual machine. + * + * @return the platformUpdateDomain value. + */ + public Integer platformUpdateDomain() { + return this.platformUpdateDomain; + } + + /** + * Set the platformUpdateDomain property: Specifies the update domain of the virtual machine. + * + * @param platformUpdateDomain the platformUpdateDomain value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withPlatformUpdateDomain(Integer platformUpdateDomain) { + this.platformUpdateDomain = platformUpdateDomain; + return this; + } + + /** + * Get the platformFaultDomain property: Specifies the fault domain of the virtual machine. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.platformFaultDomain; + } + + /** + * Set the platformFaultDomain property: Specifies the fault domain of the virtual machine. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withPlatformFaultDomain(Integer platformFaultDomain) { + this.platformFaultDomain = platformFaultDomain; + return this; + } + + /** + * Get the computerName property: The computer name assigned to the virtual machine. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: The computer name assigned to the virtual machine. + * + * @param computerName the computerName value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the osName property: The Operating System running on the virtual machine. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: The Operating System running on the virtual machine. + * + * @param osName the osName value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the osVersion property: The version of Operating System running on the virtual machine. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Set the osVersion property: The version of Operating System running on the virtual machine. + * + * @param osVersion the osVersion value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withOsVersion(String osVersion) { + this.osVersion = osVersion; + return this; + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGeneration Type associated with a resource. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationType hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGeneration Type associated with a resource. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withHyperVGeneration(HyperVGenerationType hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @return the rdpThumbPrint value. + */ + public String rdpThumbPrint() { + return this.rdpThumbPrint; + } + + /** + * Set the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @param rdpThumbPrint the rdpThumbPrint value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withRdpThumbPrint(String rdpThumbPrint) { + this.rdpThumbPrint = rdpThumbPrint; + return this; + } + + /** + * Get the vmAgent property: The VM Agent running on the virtual machine. + * + * @return the vmAgent value. + */ + public VirtualMachineAgentInstanceView vmAgent() { + return this.vmAgent; + } + + /** + * Set the vmAgent property: The VM Agent running on the virtual machine. + * + * @param vmAgent the vmAgent value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withVmAgent(VirtualMachineAgentInstanceView vmAgent) { + this.vmAgent = vmAgent; + return this; + } + + /** + * Get the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @return the maintenanceRedeployStatus value. + */ + public MaintenanceRedeployStatus maintenanceRedeployStatus() { + return this.maintenanceRedeployStatus; + } + + /** + * Set the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @param maintenanceRedeployStatus the maintenanceRedeployStatus value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withMaintenanceRedeployStatus( + MaintenanceRedeployStatus maintenanceRedeployStatus) { + this.maintenanceRedeployStatus = maintenanceRedeployStatus; + return this; + } + + /** + * Get the disks property: The virtual machine disk information. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Set the disks property: The virtual machine disk information. + * + * @param disks the disks value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withDisks(List disks) { + this.disks = disks; + return this; + } + + /** + * Get the extensions property: The extensions information. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: The extensions information. + * + * @param extensions the extensions value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withExtensions(List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get the vmHealth property: The health status for the VM. + * + * @return the vmHealth value. + */ + public VirtualMachineHealthStatus vmHealth() { + return this.vmHealth; + } + + /** + * Get the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. + * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @return the bootDiagnostics value. + */ + public BootDiagnosticsInstanceView bootDiagnostics() { + return this.bootDiagnostics; + } + + /** + * Set the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. + * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @param bootDiagnostics the bootDiagnostics value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withBootDiagnostics(BootDiagnosticsInstanceView bootDiagnostics) { + this.bootDiagnostics = bootDiagnostics; + return this; + } + + /** + * Get the assignedHost property: Resource id of the dedicated host, on which the virtual machine is allocated + * through automatic placement, when the virtual machine is associated with a dedicated host group that has + * automatic placement enabled. <br><br>Minimum api-version: 2020-06-01. + * + * @return the assignedHost value. + */ + public String assignedHost() { + return this.assignedHost; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get the patchStatus property: [Preview Feature] The status of virtual machine patch operations. + * + * @return the patchStatus value. + */ + public VirtualMachinePatchStatus patchStatus() { + return this.patchStatus; + } + + /** + * Set the patchStatus property: [Preview Feature] The status of virtual machine patch operations. + * + * @param patchStatus the patchStatus value to set. + * @return the VirtualMachineInstanceViewInner object itself. + */ + public VirtualMachineInstanceViewInner withPatchStatus(VirtualMachinePatchStatus patchStatus) { + this.patchStatus = patchStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmAgent() != null) { + vmAgent().validate(); + } + if (maintenanceRedeployStatus() != null) { + maintenanceRedeployStatus().validate(); + } + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + if (vmHealth() != null) { + vmHealth().validate(); + } + if (bootDiagnostics() != null) { + bootDiagnostics().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + if (patchStatus() != null) { + patchStatus().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceConfigurationProperties.java new file mode 100644 index 0000000000000..3e7bcfd0f3a1d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceConfigurationProperties.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine network profile's IP configuration. */ +@Fluent +public final class VirtualMachineNetworkInterfaceConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineNetworkInterfaceConfigurationProperties.class); + + /* + * Specifies the primary network interface in case the virtual machine has + * more than 1 network interface. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * Specify what happens to the network interface when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /* + * Specifies whether the network interface is accelerated + * networking-enabled. + */ + @JsonProperty(value = "enableAcceleratedNetworking") + private Boolean enableAcceleratedNetworking; + + /* + * Specifies whether the network interface is FPGA networking-enabled. + */ + @JsonProperty(value = "enableFpga") + private Boolean enableFpga; + + /* + * Whether IP forwarding enabled on this NIC. + */ + @JsonProperty(value = "enableIPForwarding") + private Boolean enableIpForwarding; + + /* + * The network security group. + */ + @JsonProperty(value = "networkSecurityGroup") + private SubResource networkSecurityGroup; + + /* + * The dns settings to be applied on the network interfaces. + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings; + + /* + * Specifies the IP configurations of the network interface. + */ + @JsonProperty(value = "ipConfigurations", required = true) + private List ipConfigurations; + + /* + * The dscpConfiguration property. + */ + @JsonProperty(value = "dscpConfiguration") + private SubResource dscpConfiguration; + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.enableAcceleratedNetworking; + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + this.enableAcceleratedNetworking = enableAcceleratedNetworking; + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.enableFpga; + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withEnableFpga(Boolean enableFpga) { + this.enableFpga = enableFpga; + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.enableIpForwarding; + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withEnableIpForwarding(Boolean enableIpForwarding) { + this.enableIpForwarding = enableIpForwarding; + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withNetworkSecurityGroup( + SubResource networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withDnsSettings( + VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.ipConfigurations; + } + + /** + * Set the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withIpConfigurations( + List ipConfigurations) { + this.ipConfigurations = ipConfigurations; + return this; + } + + /** + * Get the dscpConfiguration property: The dscpConfiguration property. + * + * @return the dscpConfiguration value. + */ + public SubResource dscpConfiguration() { + return this.dscpConfiguration; + } + + /** + * Set the dscpConfiguration property: The dscpConfiguration property. + * + * @param dscpConfiguration the dscpConfiguration value to set. + * @return the VirtualMachineNetworkInterfaceConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceConfigurationProperties withDscpConfiguration(SubResource dscpConfiguration) { + this.dscpConfiguration = dscpConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipConfigurations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ipConfigurations in model" + + " VirtualMachineNetworkInterfaceConfigurationProperties")); + } else { + ipConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceIpConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceIpConfigurationProperties.java new file mode 100644 index 0000000000000..0a8cbdee68e51 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineNetworkInterfaceIpConfigurationProperties.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.IpVersions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine network interface IP configuration properties. */ +@Fluent +public final class VirtualMachineNetworkInterfaceIpConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineNetworkInterfaceIpConfigurationProperties.class); + + /* + * Specifies the identifier of the subnet. + */ + @JsonProperty(value = "subnet") + private SubResource subnet; + + /* + * Specifies the primary network interface in case the virtual machine has + * more than 1 network interface. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * The publicIPAddressConfiguration. + */ + @JsonProperty(value = "publicIPAddressConfiguration") + private VirtualMachinePublicIpAddressConfiguration publicIpAddressConfiguration; + + /* + * Available from Api-Version 2017-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. + */ + @JsonProperty(value = "privateIPAddressVersion") + private IpVersions privateIpAddressVersion; + + /* + * Specifies an array of references to application security group. + */ + @JsonProperty(value = "applicationSecurityGroups") + private List applicationSecurityGroups; + + /* + * Specifies an array of references to backend address pools of application + * gateways. A virtual machine can reference backend address pools of + * multiple application gateways. Multiple virtual machines cannot use the + * same application gateway. + */ + @JsonProperty(value = "applicationGatewayBackendAddressPools") + private List applicationGatewayBackendAddressPools; + + /* + * Specifies an array of references to backend address pools of load + * balancers. A virtual machine can reference backend address pools of one + * public and one internal load balancer. [Multiple virtual machines cannot + * use the same basic sku load balancer]. + */ + @JsonProperty(value = "loadBalancerBackendAddressPools") + private List loadBalancerBackendAddressPools; + + /** + * Get the subnet property: Specifies the identifier of the subnet. + * + * @return the subnet value. + */ + public SubResource subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Specifies the identifier of the subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withSubnet(SubResource subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachinePublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.publicIpAddressConfiguration; + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withPublicIpAddressConfiguration( + VirtualMachinePublicIpAddressConfiguration publicIpAddressConfiguration) { + this.publicIpAddressConfiguration = publicIpAddressConfiguration; + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersions privateIpAddressVersion() { + return this.privateIpAddressVersion; + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withPrivateIpAddressVersion( + IpVersions privateIpAddressVersion) { + this.privateIpAddressVersion = privateIpAddressVersion; + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.applicationSecurityGroups; + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withApplicationSecurityGroups( + List applicationSecurityGroups) { + this.applicationSecurityGroups = applicationSecurityGroups; + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A virtual machine can reference backend address pools of multiple application gateways. + * Multiple virtual machines cannot use the same application gateway. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.applicationGatewayBackendAddressPools; + } + + /** + * Set the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A virtual machine can reference backend address pools of multiple application gateways. + * Multiple virtual machines cannot use the same application gateway. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + this.applicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A virtual machine can reference backend address pools of one public and one internal load + * balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.loadBalancerBackendAddressPools; + } + + /** + * Set the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A virtual machine can reference backend address pools of one public and one internal load + * balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineNetworkInterfaceIpConfigurationProperties object itself. + */ + public VirtualMachineNetworkInterfaceIpConfigurationProperties withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + this.loadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publicIpAddressConfiguration() != null) { + publicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePropertiesInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePropertiesInner.java new file mode 100644 index 0000000000000..7f85cb06b49df --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePropertiesInner.java @@ -0,0 +1,862 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of a Virtual Machine. */ +@Fluent +public final class VirtualMachinePropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachinePropertiesInner.class); + + /* + * Specifies the hardware settings for the virtual machine. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /* + * Specifies additional capabilities enabled or disabled on the virtual + * machine. + */ + @JsonProperty(value = "additionalCapabilities") + private AdditionalCapabilities additionalCapabilities; + + /* + * Specifies the operating system settings used while creating the virtual + * machine. Some of the settings cannot be changed once VM is provisioned. + */ + @JsonProperty(value = "osProfile") + private OSProfile osProfile; + + /* + * Specifies the network interfaces of the virtual machine. + */ + @JsonProperty(value = "networkProfile") + private NetworkProfile networkProfile; + + /* + * Specifies the Security related profile settings for the virtual machine. + */ + @JsonProperty(value = "securityProfile") + private SecurityProfile securityProfile; + + /* + * Specifies the boot diagnostic settings state.

Minimum + * api-version: 2015-06-15. + */ + @JsonProperty(value = "diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /* + * Specifies information about the availability set that the virtual + * machine should be assigned to. Virtual machines specified in the same + * availability set are allocated to different nodes to maximize + * availability. For more information about availability sets, see + * [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + *

For more information on Azure planned maintenance, see + * [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + *

Currently, a VM can only be added to availability set at + * creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set + * resource. An existing VM cannot be added to an availability set. + *

This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + */ + @JsonProperty(value = "availabilitySet") + private SubResource availabilitySet; + + /* + * Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the + * same virtual machine scale set are allocated to different nodes to + * maximize availability. Currently, a VM can only be added to virtual + * machine scale set at creation time. An existing VM cannot be added to a + * virtual machine scale set.

This property cannot exist along with + * a non-null properties.availabilitySet reference.

Minimum + * api‐version: 2019‐03‐01 + */ + @JsonProperty(value = "virtualMachineScaleSet") + private SubResource virtualMachineScaleSet; + + /* + * Specifies information about the proximity placement group that the + * virtual machine should be assigned to.

Minimum api-version: + * 2018-04-01. + */ + @JsonProperty(value = "proximityPlacementGroup") + private SubResource proximityPlacementGroup; + + /* + * Specifies the priority for the virtual machine.

Minimum + * api-version: 2019-03-01 + */ + @JsonProperty(value = "priority") + private VirtualMachinePriorityTypes priority; + + /* + * Specifies the eviction policy for the Azure Spot virtual machine and + * Azure Spot scale set.

For Azure Spot virtual machines, both + * 'Deallocate' and 'Delete' are supported and the minimum api-version is + * 2019-03-01.

For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is + * 2017-10-30-preview. + */ + @JsonProperty(value = "evictionPolicy") + private VirtualMachineEvictionPolicyTypes evictionPolicy; + + /* + * Specifies the billing related details of a Azure Spot virtual machine. + *

Minimum api-version: 2019-03-01. + */ + @JsonProperty(value = "billingProfile") + private BillingProfile billingProfile; + + /* + * Specifies information about the dedicated host that the virtual machine + * resides in.

Minimum api-version: 2018-10-01. + */ + @JsonProperty(value = "host") + private SubResource host; + + /* + * Specifies information about the dedicated host group that the virtual + * machine resides in.

Minimum api-version: 2020-06-01. + *

NOTE: User cannot specify both host and hostGroup properties. + */ + @JsonProperty(value = "hostGroup") + private SubResource hostGroup; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The virtual machine instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineInstanceViewInner instanceView; + + /* + * Specifies that the image or disk that is being used was licensed + * on-premises.

Possible values for Windows Server operating + * system are:

Windows_Client

Windows_Server

+ * Possible values for Linux Server operating system are:

+ * RHEL_BYOS (for RHEL)

SLES_BYOS (for SUSE)

For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + *

[Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + *

Minimum api-version: 2015-06-15 + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * Specifies the VM unique ID which is a 128-bits identifier that is + * encoded and stored in all Azure IaaS VMs SMBIOS and can be read using + * platform BIOS commands. + */ + @JsonProperty(value = "vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /* + * Specifies the time alloted for all extensions to start. The time + * duration should be between 15 minutes and 120 minutes (inclusive) and + * should be specified in ISO 8601 format. The default value is 90 minutes + * (PT1H30M).

Minimum api-version: 2020-06-01 + */ + @JsonProperty(value = "extensionsTimeBudget") + private String extensionsTimeBudget; + + /* + * Specifies the scale set logical fault domain into which the Virtual + * Machine will be created. By default, the Virtual Machine will by + * automatically assigned to a fault domain that best maintains balance + * across available fault domains.
  • This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.
  • The + * Virtual Machine Scale Set that is referenced, must have + * 'platformFaultDomainCount' > 1.
  • This property cannot be updated + * once the Virtual Machine is created.
  • Fault domain assignment can be + * viewed in the Virtual Machine Instance View.

    Minimum api‐version: + * 2020‐12‐01 + */ + @JsonProperty(value = "platformFaultDomain") + private Integer platformFaultDomain; + + /* + * Specifies Scheduled Event related configurations. + */ + @JsonProperty(value = "scheduledEventsProfile") + private ScheduledEventsProfile scheduledEventsProfile; + + /* + * UserData for the VM, which must be base-64 encoded. Customer should not + * pass any secrets in here.

    Minimum api-version: 2021-03-01 + */ + @JsonProperty(value = "userData") + private String userData; + + /* + * Specifies information about the capacity reservation that is used to + * allocate virtual machine.

    Minimum api-version: 2021-04-01. + */ + @JsonProperty(value = "capacityReservation") + private CapacityReservationProfile capacityReservation; + + /* + * Specifies the gallery applications that should be made available to the + * VM/VMSS + */ + @JsonProperty(value = "applicationProfile") + private ApplicationProfile applicationProfile; + + /* + * Specifies the time at which the Virtual Machine resource was + * created.

    Minimum api-version: 2021-11-01. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.additionalCapabilities; + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + this.additionalCapabilities = additionalCapabilities; + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + public SubResource availabilitySet() { + return this.availabilitySet; + } + + /** + * Set the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @param availabilitySet the availabilitySet value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withAvailabilitySet(SubResource availabilitySet) { + this.availabilitySet = availabilitySet; + return this; + } + + /** + * Get the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + public SubResource virtualMachineScaleSet() { + return this.virtualMachineScaleSet; + } + + /** + * Set the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @param virtualMachineScaleSet the virtualMachineScaleSet value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withVirtualMachineScaleSet(SubResource virtualMachineScaleSet) { + this.virtualMachineScaleSet = virtualMachineScaleSet; + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.proximityPlacementGroup; + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withProximityPlacementGroup(SubResource proximityPlacementGroup) { + this.proximityPlacementGroup = proximityPlacementGroup; + return this; + } + + /** + * Get the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + public VirtualMachinePriorityTypes priority() { + return this.priority; + } + + /** + * Set the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @param priority the priority value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withPriority(VirtualMachinePriorityTypes priority) { + this.priority = priority; + return this; + } + + /** + * Get the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.evictionPolicy; + } + + /** + * Set the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @param evictionPolicy the evictionPolicy value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) { + this.evictionPolicy = evictionPolicy; + return this; + } + + /** + * Get the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + public BillingProfile billingProfile() { + return this.billingProfile; + } + + /** + * Set the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param billingProfile the billingProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withBillingProfile(BillingProfile billingProfile) { + this.billingProfile = billingProfile; + return this; + } + + /** + * Get the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + public SubResource host() { + return this.host; + } + + /** + * Set the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @param host the host value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withHost(SubResource host) { + this.host = host; + return this; + } + + /** + * Get the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @return the hostGroup value. + */ + public SubResource hostGroup() { + return this.hostGroup; + } + + /** + * Set the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @param hostGroup the hostGroup value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withHostGroup(SubResource hostGroup) { + this.hostGroup = hostGroup; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineInstanceViewInner instanceView() { + return this.instanceView; + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + public String extensionsTimeBudget() { + return this.extensionsTimeBudget; + } + + /** + * Set the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @param extensionsTimeBudget the extensionsTimeBudget value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withExtensionsTimeBudget(String extensionsTimeBudget) { + this.extensionsTimeBudget = extensionsTimeBudget; + return this; + } + + /** + * Get the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.platformFaultDomain; + } + + /** + * Set the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withPlatformFaultDomain(Integer platformFaultDomain) { + this.platformFaultDomain = platformFaultDomain; + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.scheduledEventsProfile; + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + this.scheduledEventsProfile = scheduledEventsProfile; + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.userData; + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withUserData(String userData) { + this.userData = userData; + return this; + } + + /** + * Get the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + public CapacityReservationProfile capacityReservation() { + return this.capacityReservation; + } + + /** + * Set the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @param capacityReservation the capacityReservation value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withCapacityReservation(CapacityReservationProfile capacityReservation) { + this.capacityReservation = capacityReservation; + return this; + } + + /** + * Get the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + public ApplicationProfile applicationProfile() { + return this.applicationProfile; + } + + /** + * Set the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param applicationProfile the applicationProfile value to set. + * @return the VirtualMachinePropertiesInner object itself. + */ + public VirtualMachinePropertiesInner withApplicationProfile(ApplicationProfile applicationProfile) { + this.applicationProfile = applicationProfile; + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * 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 (additionalCapabilities() != null) { + additionalCapabilities().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (billingProfile() != null) { + billingProfile().validate(); + } + if (instanceView() != null) { + instanceView().validate(); + } + if (scheduledEventsProfile() != null) { + scheduledEventsProfile().validate(); + } + if (capacityReservation() != null) { + capacityReservation().validate(); + } + if (applicationProfile() != null) { + applicationProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePublicIpAddressConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePublicIpAddressConfigurationProperties.java new file mode 100644 index 0000000000000..c0a3b5c88b213 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachinePublicIpAddressConfigurationProperties.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.IpVersions; +import com.azure.resourcemanager.compute.generated.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressDnsSettingsConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachinePublicIpAddressConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachinePublicIpAddressConfigurationProperties.class); + + /* + * The idle timeout of the public IP address. + */ + @JsonProperty(value = "idleTimeoutInMinutes") + private Integer idleTimeoutInMinutes; + + /* + * Specify what happens to the public IP address when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /* + * The dns settings to be applied on the publicIP addresses . + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings; + + /* + * The list of IP tags associated with the public IP address. + */ + @JsonProperty(value = "ipTags") + private List ipTags; + + /* + * The PublicIPPrefix from which to allocate publicIP addresses. + */ + @JsonProperty(value = "publicIPPrefix") + private SubResource publicIpPrefix; + + /* + * Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. + */ + @JsonProperty(value = "publicIPAddressVersion") + private IpVersions publicIpAddressVersion; + + /* + * Specify the public IP allocation type + */ + @JsonProperty(value = "publicIPAllocationMethod") + private PublicIpAllocationMethod publicIpAllocationMethod; + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.idleTimeoutInMinutes; + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withIdleTimeoutInMinutes(Integer idleTimeoutInMinutes) { + this.idleTimeoutInMinutes = idleTimeoutInMinutes; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP address when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the public IP address when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withDnsSettings( + VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipTags property: The list of IP tags associated with the public IP address. + * + * @return the ipTags value. + */ + public List ipTags() { + return this.ipTags; + } + + /** + * Set the ipTags property: The list of IP tags associated with the public IP address. + * + * @param ipTags the ipTags value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withIpTags(List ipTags) { + this.ipTags = ipTags; + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.publicIpPrefix; + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withPublicIpPrefix(SubResource publicIpPrefix) { + this.publicIpPrefix = publicIpPrefix; + return this; + } + + /** + * Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the publicIpAddressVersion value. + */ + public IpVersions publicIpAddressVersion() { + return this.publicIpAddressVersion; + } + + /** + * Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param publicIpAddressVersion the publicIpAddressVersion value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withPublicIpAddressVersion( + IpVersions publicIpAddressVersion) { + this.publicIpAddressVersion = publicIpAddressVersion; + return this; + } + + /** + * Get the publicIpAllocationMethod property: Specify the public IP allocation type. + * + * @return the publicIpAllocationMethod value. + */ + public PublicIpAllocationMethod publicIpAllocationMethod() { + return this.publicIpAllocationMethod; + } + + /** + * Set the publicIpAllocationMethod property: Specify the public IP allocation type. + * + * @param publicIpAllocationMethod the publicIpAllocationMethod value to set. + * @return the VirtualMachinePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachinePublicIpAddressConfigurationProperties withPublicIpAllocationMethod( + PublicIpAllocationMethod publicIpAllocationMethod) { + this.publicIpAllocationMethod = publicIpAllocationMethod; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipTags() != null) { + ipTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandInner.java new file mode 100644 index 0000000000000..8a9f951939c8b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandInner.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine run command. */ +@Fluent +public final class VirtualMachineRunCommandInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandInner.class); + + /* + * Describes the properties of a Virtual Machine run command. + */ + @JsonProperty(value = "properties") + private VirtualMachineRunCommandProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine run command. + * + * @return the innerProperties value. + */ + private VirtualMachineRunCommandProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineRunCommandInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineRunCommandInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the source property: The source of the run command script. + * + * @return the source value. + */ + public VirtualMachineRunCommandScriptSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The source of the run command script. + * + * @param source the source value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withSource(VirtualMachineRunCommandScriptSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + public List parameters() { + return this.innerProperties() == null ? null : this.innerProperties().parameters(); + } + + /** + * Set the parameters property: The parameters used by the script. + * + * @param parameters the parameters value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withParameters(List parameters) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withParameters(parameters); + return this; + } + + /** + * Get the protectedParameters property: The parameters used by the script. + * + * @return the protectedParameters value. + */ + public List protectedParameters() { + return this.innerProperties() == null ? null : this.innerProperties().protectedParameters(); + } + + /** + * Set the protectedParameters property: The parameters used by the script. + * + * @param protectedParameters the protectedParameters value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withProtectedParameters(List protectedParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withProtectedParameters(protectedParameters); + return this; + } + + /** + * Get the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @return the asyncExecution value. + */ + public Boolean asyncExecution() { + return this.innerProperties() == null ? null : this.innerProperties().asyncExecution(); + } + + /** + * Set the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @param asyncExecution the asyncExecution value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withAsyncExecution(Boolean asyncExecution) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withAsyncExecution(asyncExecution); + return this; + } + + /** + * Get the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value. + */ + public String runAsUser() { + return this.innerProperties() == null ? null : this.innerProperties().runAsUser(); + } + + /** + * Set the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @param runAsUser the runAsUser value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withRunAsUser(String runAsUser) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withRunAsUser(runAsUser); + return this; + } + + /** + * Get the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value. + */ + public String runAsPassword() { + return this.innerProperties() == null ? null : this.innerProperties().runAsPassword(); + } + + /** + * Set the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @param runAsPassword the runAsPassword value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withRunAsPassword(String runAsPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withRunAsPassword(runAsPassword); + return this; + } + + /** + * Get the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value. + */ + public Integer timeoutInSeconds() { + return this.innerProperties() == null ? null : this.innerProperties().timeoutInSeconds(); + } + + /** + * Set the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @param timeoutInSeconds the timeoutInSeconds value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withTimeoutInSeconds(Integer timeoutInSeconds) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withTimeoutInSeconds(timeoutInSeconds); + return this; + } + + /** + * Get the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value. + */ + public String outputBlobUri() { + return this.innerProperties() == null ? null : this.innerProperties().outputBlobUri(); + } + + /** + * Set the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @param outputBlobUri the outputBlobUri value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withOutputBlobUri(String outputBlobUri) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withOutputBlobUri(outputBlobUri); + return this; + } + + /** + * Get the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value. + */ + public String errorBlobUri() { + return this.innerProperties() == null ? null : this.innerProperties().errorBlobUri(); + } + + /** + * Set the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @param errorBlobUri the errorBlobUri value to set. + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withErrorBlobUri(String errorBlobUri) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withErrorBlobUri(errorBlobUri); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine run command instance view. + * + * @return the instanceView value. + */ + public VirtualMachineRunCommandInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandProperties.java new file mode 100644 index 0000000000000..62d33f55298ec --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineRunCommandProperties.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a Virtual Machine run command. */ +@Fluent +public final class VirtualMachineRunCommandProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandProperties.class); + + /* + * The source of the run command script. + */ + @JsonProperty(value = "source") + private VirtualMachineRunCommandScriptSource source; + + /* + * The parameters used by the script. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /* + * The parameters used by the script. + */ + @JsonProperty(value = "protectedParameters") + private List protectedParameters; + + /* + * Optional. If set to true, provisioning will complete as soon as the + * script starts and will not wait for script to complete. + */ + @JsonProperty(value = "asyncExecution") + private Boolean asyncExecution; + + /* + * Specifies the user account on the VM when executing the run command. + */ + @JsonProperty(value = "runAsUser") + private String runAsUser; + + /* + * Specifies the user account password on the VM when executing the run + * command. + */ + @JsonProperty(value = "runAsPassword") + private String runAsPassword; + + /* + * The timeout in seconds to execute the run command. + */ + @JsonProperty(value = "timeoutInSeconds") + private Integer timeoutInSeconds; + + /* + * Specifies the Azure storage blob where script output stream will be + * uploaded. + */ + @JsonProperty(value = "outputBlobUri") + private String outputBlobUri; + + /* + * Specifies the Azure storage blob where script error stream will be + * uploaded. + */ + @JsonProperty(value = "errorBlobUri") + private String errorBlobUri; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The virtual machine run command instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineRunCommandInstanceView instanceView; + + /** + * Get the source property: The source of the run command script. + * + * @return the source value. + */ + public VirtualMachineRunCommandScriptSource source() { + return this.source; + } + + /** + * Set the source property: The source of the run command script. + * + * @param source the source value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withSource(VirtualMachineRunCommandScriptSource source) { + this.source = source; + return this; + } + + /** + * Get the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters used by the script. + * + * @param parameters the parameters value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the protectedParameters property: The parameters used by the script. + * + * @return the protectedParameters value. + */ + public List protectedParameters() { + return this.protectedParameters; + } + + /** + * Set the protectedParameters property: The parameters used by the script. + * + * @param protectedParameters the protectedParameters value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withProtectedParameters( + List protectedParameters) { + this.protectedParameters = protectedParameters; + return this; + } + + /** + * Get the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @return the asyncExecution value. + */ + public Boolean asyncExecution() { + return this.asyncExecution; + } + + /** + * Set the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @param asyncExecution the asyncExecution value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withAsyncExecution(Boolean asyncExecution) { + this.asyncExecution = asyncExecution; + return this; + } + + /** + * Get the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value. + */ + public String runAsUser() { + return this.runAsUser; + } + + /** + * Set the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @param runAsUser the runAsUser value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + return this; + } + + /** + * Get the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value. + */ + public String runAsPassword() { + return this.runAsPassword; + } + + /** + * Set the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @param runAsPassword the runAsPassword value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withRunAsPassword(String runAsPassword) { + this.runAsPassword = runAsPassword; + return this; + } + + /** + * Get the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value. + */ + public Integer timeoutInSeconds() { + return this.timeoutInSeconds; + } + + /** + * Set the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @param timeoutInSeconds the timeoutInSeconds value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withTimeoutInSeconds(Integer timeoutInSeconds) { + this.timeoutInSeconds = timeoutInSeconds; + return this; + } + + /** + * Get the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value. + */ + public String outputBlobUri() { + return this.outputBlobUri; + } + + /** + * Set the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @param outputBlobUri the outputBlobUri value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withOutputBlobUri(String outputBlobUri) { + this.outputBlobUri = outputBlobUri; + return this; + } + + /** + * Get the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value. + */ + public String errorBlobUri() { + return this.errorBlobUri; + } + + /** + * Set the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @param errorBlobUri the errorBlobUri value to set. + * @return the VirtualMachineRunCommandProperties object itself. + */ + public VirtualMachineRunCommandProperties withErrorBlobUri(String errorBlobUri) { + this.errorBlobUri = errorBlobUri; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The virtual machine run command instance view. + * + * @return the instanceView value. + */ + public VirtualMachineRunCommandInstanceView instanceView() { + return this.instanceView; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + if (protectedParameters() != null) { + protectedParameters().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionInner.java new file mode 100644 index 0000000000000..e4120d8550f0a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionInner.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a Virtual Machine Scale Set Extension. */ +@Fluent +public final class VirtualMachineScaleSetExtensionInner extends SubResourceReadOnly { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionInner.class); + + /* + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Describes the properties of a Virtual Machine Scale Set Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetExtensionProperties innerProperties; + + /** + * Get the name property: The name of the extension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the extension. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Scale Set Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + public List provisionAfterExtensions() { + return this.innerProperties() == null ? null : this.innerProperties().provisionAfterExtensions(); + } + + /** + * Set the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @param provisionAfterExtensions the provisionAfterExtensions value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withProvisionAfterExtensions(List provisionAfterExtensions) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProvisionAfterExtensions(provisionAfterExtensions); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetExtensionInner object itself. + */ + public VirtualMachineScaleSetExtensionInner withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionProperties.java new file mode 100644 index 0000000000000..1404d9faeb14d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetExtensionProperties.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a Virtual Machine Scale Set Extension. */ +@Fluent +public final class VirtualMachineScaleSetExtensionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionProperties.class); + + /* + * If a value is provided and is different from the previous value, the + * extension handler will be forced to update even if the extension + * configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + */ + @JsonProperty(value = "enableAutomaticUpgrade") + private Boolean enableAutomaticUpgrade; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Collection of extension names after which this extension needs to be + * provisioned. + */ + @JsonProperty(value = "provisionAfterExtensions") + private List provisionAfterExtensions; + + /* + * Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will + * not be suppressed regardless of this value). The default is false. + */ + @JsonProperty(value = "suppressFailures") + private Boolean suppressFailures; + + /* + * The extensions protected settings that are passed by reference, and + * consumed from key vault + */ + @JsonProperty(value = "protectedSettingsFromKeyVault") + private Object protectedSettingsFromKeyVault; + + /** + * Get the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.enableAutomaticUpgrade; + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + this.enableAutomaticUpgrade = enableAutomaticUpgrade; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + public List provisionAfterExtensions() { + return this.provisionAfterExtensions; + } + + /** + * Set the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @param provisionAfterExtensions the provisionAfterExtensions value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withProvisionAfterExtensions( + List provisionAfterExtensions) { + this.provisionAfterExtensions = provisionAfterExtensions; + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.suppressFailures; + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withSuppressFailures(Boolean suppressFailures) { + this.suppressFailures = suppressFailures; + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.protectedSettingsFromKeyVault; + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + this.protectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInner.java new file mode 100644 index 0000000000000..c8955ae0ab426 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInner.java @@ -0,0 +1,605 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.OrchestrationMode; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine Scale Set. */ +@Fluent +public final class VirtualMachineScaleSetInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetInner.class); + + /* + * The virtual machine scale set sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Specifies information about the marketplace image used to create the + * virtual machine. This element is only used for marketplace images. + * Before you can use a marketplace image from an API, you must enable the + * image for programmatic use. In the Azure portal, find the marketplace + * image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information and + * then click **Save**. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * Describes the properties of a Virtual Machine Scale Set. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetProperties innerProperties; + + /* + * The identity of the virtual machine scale set, if configured. + */ + @JsonProperty(value = "identity") + private VirtualMachineScaleSetIdentity identity; + + /* + * The virtual machine scale set zones. NOTE: Availability zones can only + * be set when you create the scale set + */ + @JsonProperty(value = "zones") + private List zones; + + /* + * The extended location of the Virtual Machine Scale Set. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the sku property: The virtual machine scale set sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The virtual machine scale set sku. + * + * @param sku the sku value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @param plan the plan value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Scale Set. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The identity of the virtual machine scale set, if configured. + * + * @return the identity value. + */ + public VirtualMachineScaleSetIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the virtual machine scale set, if configured. + * + * @param identity the identity value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withIdentity(VirtualMachineScaleSetIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the zones property: The virtual machine scale set zones. NOTE: Availability zones can only be set when you + * create the scale set. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The virtual machine scale set zones. NOTE: Availability zones can only be set when you + * create the scale set. + * + * @param zones the zones value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the extendedLocation property: The extended location of the Virtual Machine Scale Set. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location of the Virtual Machine Scale Set. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the upgradePolicy property: The upgrade policy. + * + * @return the upgradePolicy value. + */ + public UpgradePolicy upgradePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().upgradePolicy(); + } + + /** + * Set the upgradePolicy property: The upgrade policy. + * + * @param upgradePolicy the upgradePolicy value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withUpgradePolicy(UpgradePolicy upgradePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withUpgradePolicy(upgradePolicy); + return this; + } + + /** + * Get the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @return the automaticRepairsPolicy value. + */ + public AutomaticRepairsPolicy automaticRepairsPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().automaticRepairsPolicy(); + } + + /** + * Set the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @param automaticRepairsPolicy the automaticRepairsPolicy value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withAutomaticRepairsPolicy(automaticRepairsPolicy); + return this; + } + + /** + * Get the virtualMachineProfile property: The virtual machine profile. + * + * @return the virtualMachineProfile value. + */ + public VirtualMachineScaleSetVMProfile virtualMachineProfile() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineProfile(); + } + + /** + * Set the virtualMachineProfile property: The virtual machine profile. + * + * @param virtualMachineProfile the virtualMachineProfile value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withVirtualMachineProfile( + VirtualMachineScaleSetVMProfile virtualMachineProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withVirtualMachineProfile(virtualMachineProfile); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @return the overprovision value. + */ + public Boolean overprovision() { + return this.innerProperties() == null ? null : this.innerProperties().overprovision(); + } + + /** + * Set the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @param overprovision the overprovision value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withOverprovision(Boolean overprovision) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withOverprovision(overprovision); + return this; + } + + /** + * Get the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @return the doNotRunExtensionsOnOverprovisionedVMs value. + */ + public Boolean doNotRunExtensionsOnOverprovisionedVMs() { + return this.innerProperties() == null ? null : this.innerProperties().doNotRunExtensionsOnOverprovisionedVMs(); + } + + /** + * Set the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @param doNotRunExtensionsOnOverprovisionedVMs the doNotRunExtensionsOnOverprovisionedVMs value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withDoNotRunExtensionsOnOverprovisionedVMs( + Boolean doNotRunExtensionsOnOverprovisionedVMs) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withDoNotRunExtensionsOnOverprovisionedVMs(doNotRunExtensionsOnOverprovisionedVMs); + return this; + } + + /** + * Get the uniqueId property: Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerProperties() == null ? null : this.innerProperties().uniqueId(); + } + + /** + * Get the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @return the singlePlacementGroup value. + */ + public Boolean singlePlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().singlePlacementGroup(); + } + + /** + * Set the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @param singlePlacementGroup the singlePlacementGroup value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withSinglePlacementGroup(Boolean singlePlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withSinglePlacementGroup(singlePlacementGroup); + return this; + } + + /** + * Get the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more + * than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + * + * @return the zoneBalance value. + */ + public Boolean zoneBalance() { + return this.innerProperties() == null ? null : this.innerProperties().zoneBalance(); + } + + /** + * Set the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more + * than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + * + * @param zoneBalance the zoneBalance value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withZoneBalance(Boolean zoneBalance) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withZoneBalance(zoneBalance); + return this; + } + + /** + * Get the platformFaultDomainCount property: Fault Domain count for each placement group. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomainCount(); + } + + /** + * Set the platformFaultDomainCount property: Fault Domain count for each placement group. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Get the hostGroup property: Specifies information about the dedicated host group that the virtual machine scale + * set resides in. <br><br>Minimum api-version: 2020-06-01. + * + * @return the hostGroup value. + */ + public SubResource hostGroup() { + return this.innerProperties() == null ? null : this.innerProperties().hostGroup(); + } + + /** + * Set the hostGroup property: Specifies information about the dedicated host group that the virtual machine scale + * set resides in. <br><br>Minimum api-version: 2020-06-01. + * + * @param hostGroup the hostGroup value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withHostGroup(SubResource hostGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withHostGroup(hostGroup); + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities(); + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withAdditionalCapabilities(additionalCapabilities); + return this; + } + + /** + * Get the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @return the scaleInPolicy value. + */ + public ScaleInPolicy scaleInPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().scaleInPolicy(); + } + + /** + * Set the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @param scaleInPolicy the scaleInPolicy value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withScaleInPolicy(ScaleInPolicy scaleInPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withScaleInPolicy(scaleInPolicy); + return this; + } + + /** + * Get the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale set. + * + * @return the orchestrationMode value. + */ + public OrchestrationMode orchestrationMode() { + return this.innerProperties() == null ? null : this.innerProperties().orchestrationMode(); + } + + /** + * Set the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale set. + * + * @param orchestrationMode the orchestrationMode value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withOrchestrationMode(OrchestrationMode orchestrationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withOrchestrationMode(orchestrationMode); + return this; + } + + /** + * Get the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set. + * + * @return the spotRestorePolicy value. + */ + public SpotRestorePolicy spotRestorePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().spotRestorePolicy(); + } + + /** + * Set the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set. + * + * @param spotRestorePolicy the spotRestorePolicy value to set. + * @return the VirtualMachineScaleSetInner object itself. + */ + public VirtualMachineScaleSetInner withSpotRestorePolicy(SpotRestorePolicy spotRestorePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetProperties(); + } + this.innerProperties().withSpotRestorePolicy(spotRestorePolicy); + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Virtual Machine Scale Set resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInstanceViewInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInstanceViewInner.java new file mode 100644 index 0000000000000..08f4f08733b87 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetInstanceViewInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceSummary; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetInstanceViewStatusesSummary; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionsSummary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a virtual machine scale set. */ +@Fluent +public final class VirtualMachineScaleSetInstanceViewInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetInstanceViewInner.class); + + /* + * The instance view status summary for the virtual machine scale set. + */ + @JsonProperty(value = "virtualMachine", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine; + + /* + * The extensions information. + */ + @JsonProperty(value = "extensions", access = JsonProperty.Access.WRITE_ONLY) + private List extensions; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /* + * The orchestration services information. + */ + @JsonProperty(value = "orchestrationServices", access = JsonProperty.Access.WRITE_ONLY) + private List orchestrationServices; + + /** + * Get the virtualMachine property: The instance view status summary for the virtual machine scale set. + * + * @return the virtualMachine value. + */ + public VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine() { + return this.virtualMachine; + } + + /** + * Get the extensions property: The extensions information. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineScaleSetInstanceViewInner object itself. + */ + public VirtualMachineScaleSetInstanceViewInner withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get the orchestrationServices property: The orchestration services information. + * + * @return the orchestrationServices value. + */ + public List orchestrationServices() { + return this.orchestrationServices; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachine() != null) { + virtualMachine().validate(); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + if (orchestrationServices() != null) { + orchestrationServices().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetIpConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetIpConfigurationProperties.java new file mode 100644 index 0000000000000..9e03b1ff440a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetIpConfigurationProperties.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's IP configuration properties. */ +@Fluent +public final class VirtualMachineScaleSetIpConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetIpConfigurationProperties.class); + + /* + * Specifies the identifier of the subnet. + */ + @JsonProperty(value = "subnet") + private ApiEntityReference subnet; + + /* + * Specifies the primary network interface in case the virtual machine has + * more than 1 network interface. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * The publicIPAddressConfiguration. + */ + @JsonProperty(value = "publicIPAddressConfiguration") + private VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration; + + /* + * Available from Api-Version 2017-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. + */ + @JsonProperty(value = "privateIPAddressVersion") + private IpVersion privateIpAddressVersion; + + /* + * Specifies an array of references to backend address pools of application + * gateways. A scale set can reference backend address pools of multiple + * application gateways. Multiple scale sets cannot use the same + * application gateway. + */ + @JsonProperty(value = "applicationGatewayBackendAddressPools") + private List applicationGatewayBackendAddressPools; + + /* + * Specifies an array of references to application security group. + */ + @JsonProperty(value = "applicationSecurityGroups") + private List applicationSecurityGroups; + + /* + * Specifies an array of references to backend address pools of load + * balancers. A scale set can reference backend address pools of one public + * and one internal load balancer. Multiple scale sets cannot use the same + * basic sku load balancer. + */ + @JsonProperty(value = "loadBalancerBackendAddressPools") + private List loadBalancerBackendAddressPools; + + /* + * Specifies an array of references to inbound Nat pools of the load + * balancers. A scale set can reference inbound nat pools of one public and + * one internal load balancer. Multiple scale sets cannot use the same + * basic sku load balancer. + */ + @JsonProperty(value = "loadBalancerInboundNatPools") + private List loadBalancerInboundNatPools; + + /** + * Get the subnet property: Specifies the identifier of the subnet. + * + * @return the subnet value. + */ + public ApiEntityReference subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Specifies the identifier of the subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withSubnet(ApiEntityReference subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.publicIpAddressConfiguration; + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withPublicIpAddressConfiguration( + VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration) { + this.publicIpAddressConfiguration = publicIpAddressConfiguration; + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersion privateIpAddressVersion() { + return this.privateIpAddressVersion; + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withPrivateIpAddressVersion( + IpVersion privateIpAddressVersion) { + this.privateIpAddressVersion = privateIpAddressVersion; + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A scale set can reference backend address pools of multiple application gateways. + * Multiple scale sets cannot use the same application gateway. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.applicationGatewayBackendAddressPools; + } + + /** + * Set the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A scale set can reference backend address pools of multiple application gateways. + * Multiple scale sets cannot use the same application gateway. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + this.applicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.applicationSecurityGroups; + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withApplicationSecurityGroups( + List applicationSecurityGroups) { + this.applicationSecurityGroups = applicationSecurityGroups; + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A scale set can reference backend address pools of one public and one internal load balancer. + * Multiple scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.loadBalancerBackendAddressPools; + } + + /** + * Set the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A scale set can reference backend address pools of one public and one internal load balancer. + * Multiple scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + this.loadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + return this; + } + + /** + * Get the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple + * scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerInboundNatPools value. + */ + public List loadBalancerInboundNatPools() { + return this.loadBalancerInboundNatPools; + } + + /** + * Set the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple + * scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withLoadBalancerInboundNatPools( + List loadBalancerInboundNatPools) { + this.loadBalancerInboundNatPools = loadBalancerInboundNatPools; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnet() != null) { + subnet().validate(); + } + if (publicIpAddressConfiguration() != null) { + publicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetNetworkConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetNetworkConfigurationProperties.java new file mode 100644 index 0000000000000..e9069ac363ff7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetNetworkConfigurationProperties.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's IP configuration. */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetNetworkConfigurationProperties.class); + + /* + * Specifies the primary network interface in case the virtual machine has + * more than 1 network interface. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * Specifies whether the network interface is accelerated + * networking-enabled. + */ + @JsonProperty(value = "enableAcceleratedNetworking") + private Boolean enableAcceleratedNetworking; + + /* + * Specifies whether the network interface is FPGA networking-enabled. + */ + @JsonProperty(value = "enableFpga") + private Boolean enableFpga; + + /* + * The network security group. + */ + @JsonProperty(value = "networkSecurityGroup") + private SubResource networkSecurityGroup; + + /* + * The dns settings to be applied on the network interfaces. + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings; + + /* + * Specifies the IP configurations of the network interface. + */ + @JsonProperty(value = "ipConfigurations", required = true) + private List ipConfigurations; + + /* + * Whether IP forwarding enabled on this NIC. + */ + @JsonProperty(value = "enableIPForwarding") + private Boolean enableIpForwarding; + + /* + * Specify what happens to the network interface when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.enableAcceleratedNetworking; + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + this.enableAcceleratedNetworking = enableAcceleratedNetworking; + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.enableFpga; + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withEnableFpga(Boolean enableFpga) { + this.enableFpga = enableFpga; + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withNetworkSecurityGroup( + SubResource networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withDnsSettings( + VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.ipConfigurations; + } + + /** + * Set the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withIpConfigurations( + List ipConfigurations) { + this.ipConfigurations = ipConfigurations; + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.enableIpForwarding; + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withEnableIpForwarding(Boolean enableIpForwarding) { + this.enableIpForwarding = enableIpForwarding; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipConfigurations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ipConfigurations in model" + + " VirtualMachineScaleSetNetworkConfigurationProperties")); + } else { + ipConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetProperties.java new file mode 100644 index 0000000000000..95002b715083c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetProperties.java @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.OrchestrationMode; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of a Virtual Machine Scale Set. */ +@Fluent +public final class VirtualMachineScaleSetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetProperties.class); + + /* + * The upgrade policy. + */ + @JsonProperty(value = "upgradePolicy") + private UpgradePolicy upgradePolicy; + + /* + * Policy for automatic repairs. + */ + @JsonProperty(value = "automaticRepairsPolicy") + private AutomaticRepairsPolicy automaticRepairsPolicy; + + /* + * The virtual machine profile. + */ + @JsonProperty(value = "virtualMachineProfile") + private VirtualMachineScaleSetVMProfile virtualMachineProfile; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Specifies whether the Virtual Machine Scale Set should be + * overprovisioned. + */ + @JsonProperty(value = "overprovision") + private Boolean overprovision; + + /* + * When Overprovision is enabled, extensions are launched only on the + * requested number of VMs which are finally kept. This property will hence + * ensure that the extensions do not run on the extra overprovisioned VMs. + */ + @JsonProperty(value = "doNotRunExtensionsOnOverprovisionedVMs") + private Boolean doNotRunExtensionsOnOverprovisionedVMs; + + /* + * Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + */ + @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueId; + + /* + * When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may + * be modified to false. However, if singlePlacementGroup is false, it may + * not be modified to true. + */ + @JsonProperty(value = "singlePlacementGroup") + private Boolean singlePlacementGroup; + + /* + * Whether to force strictly even Virtual Machine distribution cross + * x-zones in case there is zone outage. zoneBalance property can only be + * set if the zones property of the scale set contains more than one zone. + * If there are no zones or only one zone specified, then zoneBalance + * property should not be set. + */ + @JsonProperty(value = "zoneBalance") + private Boolean zoneBalance; + + /* + * Fault Domain count for each placement group. + */ + @JsonProperty(value = "platformFaultDomainCount") + private Integer platformFaultDomainCount; + + /* + * Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to.

    Minimum + * api-version: 2018-04-01. + */ + @JsonProperty(value = "proximityPlacementGroup") + private SubResource proximityPlacementGroup; + + /* + * Specifies information about the dedicated host group that the virtual + * machine scale set resides in.

    Minimum api-version: 2020-06-01. + */ + @JsonProperty(value = "hostGroup") + private SubResource hostGroup; + + /* + * Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the + * Virtual Machines have the capability to support attaching managed data + * disks with UltraSSD_LRS storage account type. + */ + @JsonProperty(value = "additionalCapabilities") + private AdditionalCapabilities additionalCapabilities; + + /* + * Specifies the policies applied when scaling in Virtual Machines in the + * Virtual Machine Scale Set. + */ + @JsonProperty(value = "scaleInPolicy") + private ScaleInPolicy scaleInPolicy; + + /* + * Specifies the orchestration mode for the virtual machine scale set. + */ + @JsonProperty(value = "orchestrationMode") + private OrchestrationMode orchestrationMode; + + /* + * Specifies the Spot Restore properties for the virtual machine scale set. + */ + @JsonProperty(value = "spotRestorePolicy") + private SpotRestorePolicy spotRestorePolicy; + + /* + * Specifies the time at which the Virtual Machine Scale Set resource was + * created.

    Minimum api-version: 2021-11-01. + */ + @JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timeCreated; + + /** + * Get the upgradePolicy property: The upgrade policy. + * + * @return the upgradePolicy value. + */ + public UpgradePolicy upgradePolicy() { + return this.upgradePolicy; + } + + /** + * Set the upgradePolicy property: The upgrade policy. + * + * @param upgradePolicy the upgradePolicy value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withUpgradePolicy(UpgradePolicy upgradePolicy) { + this.upgradePolicy = upgradePolicy; + return this; + } + + /** + * Get the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @return the automaticRepairsPolicy value. + */ + public AutomaticRepairsPolicy automaticRepairsPolicy() { + return this.automaticRepairsPolicy; + } + + /** + * Set the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @param automaticRepairsPolicy the automaticRepairsPolicy value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy) { + this.automaticRepairsPolicy = automaticRepairsPolicy; + return this; + } + + /** + * Get the virtualMachineProfile property: The virtual machine profile. + * + * @return the virtualMachineProfile value. + */ + public VirtualMachineScaleSetVMProfile virtualMachineProfile() { + return this.virtualMachineProfile; + } + + /** + * Set the virtualMachineProfile property: The virtual machine profile. + * + * @param virtualMachineProfile the virtualMachineProfile value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withVirtualMachineProfile( + VirtualMachineScaleSetVMProfile virtualMachineProfile) { + this.virtualMachineProfile = virtualMachineProfile; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @return the overprovision value. + */ + public Boolean overprovision() { + return this.overprovision; + } + + /** + * Set the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @param overprovision the overprovision value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withOverprovision(Boolean overprovision) { + this.overprovision = overprovision; + return this; + } + + /** + * Get the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @return the doNotRunExtensionsOnOverprovisionedVMs value. + */ + public Boolean doNotRunExtensionsOnOverprovisionedVMs() { + return this.doNotRunExtensionsOnOverprovisionedVMs; + } + + /** + * Set the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @param doNotRunExtensionsOnOverprovisionedVMs the doNotRunExtensionsOnOverprovisionedVMs value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withDoNotRunExtensionsOnOverprovisionedVMs( + Boolean doNotRunExtensionsOnOverprovisionedVMs) { + this.doNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + return this; + } + + /** + * Get the uniqueId property: Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @return the singlePlacementGroup value. + */ + public Boolean singlePlacementGroup() { + return this.singlePlacementGroup; + } + + /** + * Set the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @param singlePlacementGroup the singlePlacementGroup value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withSinglePlacementGroup(Boolean singlePlacementGroup) { + this.singlePlacementGroup = singlePlacementGroup; + return this; + } + + /** + * Get the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more + * than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + * + * @return the zoneBalance value. + */ + public Boolean zoneBalance() { + return this.zoneBalance; + } + + /** + * Set the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more + * than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + * + * @param zoneBalance the zoneBalance value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withZoneBalance(Boolean zoneBalance) { + this.zoneBalance = zoneBalance; + return this; + } + + /** + * Get the platformFaultDomainCount property: Fault Domain count for each placement group. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.platformFaultDomainCount; + } + + /** + * Set the platformFaultDomainCount property: Fault Domain count for each placement group. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + this.platformFaultDomainCount = platformFaultDomainCount; + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.proximityPlacementGroup; + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withProximityPlacementGroup(SubResource proximityPlacementGroup) { + this.proximityPlacementGroup = proximityPlacementGroup; + return this; + } + + /** + * Get the hostGroup property: Specifies information about the dedicated host group that the virtual machine scale + * set resides in. <br><br>Minimum api-version: 2020-06-01. + * + * @return the hostGroup value. + */ + public SubResource hostGroup() { + return this.hostGroup; + } + + /** + * Set the hostGroup property: Specifies information about the dedicated host group that the virtual machine scale + * set resides in. <br><br>Minimum api-version: 2020-06-01. + * + * @param hostGroup the hostGroup value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withHostGroup(SubResource hostGroup) { + this.hostGroup = hostGroup; + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.additionalCapabilities; + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + this.additionalCapabilities = additionalCapabilities; + return this; + } + + /** + * Get the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @return the scaleInPolicy value. + */ + public ScaleInPolicy scaleInPolicy() { + return this.scaleInPolicy; + } + + /** + * Set the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @param scaleInPolicy the scaleInPolicy value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withScaleInPolicy(ScaleInPolicy scaleInPolicy) { + this.scaleInPolicy = scaleInPolicy; + return this; + } + + /** + * Get the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale set. + * + * @return the orchestrationMode value. + */ + public OrchestrationMode orchestrationMode() { + return this.orchestrationMode; + } + + /** + * Set the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale set. + * + * @param orchestrationMode the orchestrationMode value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withOrchestrationMode(OrchestrationMode orchestrationMode) { + this.orchestrationMode = orchestrationMode; + return this; + } + + /** + * Get the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set. + * + * @return the spotRestorePolicy value. + */ + public SpotRestorePolicy spotRestorePolicy() { + return this.spotRestorePolicy; + } + + /** + * Set the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set. + * + * @param spotRestorePolicy the spotRestorePolicy value to set. + * @return the VirtualMachineScaleSetProperties object itself. + */ + public VirtualMachineScaleSetProperties withSpotRestorePolicy(SpotRestorePolicy spotRestorePolicy) { + this.spotRestorePolicy = spotRestorePolicy; + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Virtual Machine Scale Set resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (upgradePolicy() != null) { + upgradePolicy().validate(); + } + if (automaticRepairsPolicy() != null) { + automaticRepairsPolicy().validate(); + } + if (virtualMachineProfile() != null) { + virtualMachineProfile().validate(); + } + if (additionalCapabilities() != null) { + additionalCapabilities().validate(); + } + if (scaleInPolicy() != null) { + scaleInPolicy().validate(); + } + if (spotRestorePolicy() != null) { + spotRestorePolicy().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java new file mode 100644 index 0000000000000..9a12caa049d9d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetPublicIpAddressConfigurationProperties.class); + + /* + * The idle timeout of the public IP address. + */ + @JsonProperty(value = "idleTimeoutInMinutes") + private Integer idleTimeoutInMinutes; + + /* + * The dns settings to be applied on the publicIP addresses . + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings; + + /* + * The list of IP tags associated with the public IP address. + */ + @JsonProperty(value = "ipTags") + private List ipTags; + + /* + * The PublicIPPrefix from which to allocate publicIP addresses. + */ + @JsonProperty(value = "publicIPPrefix") + private SubResource publicIpPrefix; + + /* + * Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. + */ + @JsonProperty(value = "publicIPAddressVersion") + private IpVersion publicIpAddressVersion; + + /* + * Specify what happens to the public IP when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.idleTimeoutInMinutes; + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withIdleTimeoutInMinutes( + Integer idleTimeoutInMinutes) { + this.idleTimeoutInMinutes = idleTimeoutInMinutes; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withDnsSettings( + VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipTags property: The list of IP tags associated with the public IP address. + * + * @return the ipTags value. + */ + public List ipTags() { + return this.ipTags; + } + + /** + * Set the ipTags property: The list of IP tags associated with the public IP address. + * + * @param ipTags the ipTags value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withIpTags( + List ipTags) { + this.ipTags = ipTags; + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.publicIpPrefix; + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withPublicIpPrefix(SubResource publicIpPrefix) { + this.publicIpPrefix = publicIpPrefix; + return this; + } + + /** + * Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the publicIpAddressVersion value. + */ + public IpVersion publicIpAddressVersion() { + return this.publicIpAddressVersion; + } + + /** + * Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param publicIpAddressVersion the publicIpAddressVersion value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withPublicIpAddressVersion( + IpVersion publicIpAddressVersion) { + this.publicIpAddressVersion = publicIpAddressVersion; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipTags() != null) { + ipTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetSkuInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetSkuInner.java new file mode 100644 index 0000000000000..e83f1b3463f9c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetSkuInner.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetSkuCapacity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an available virtual machine scale set sku. */ +@Immutable +public final class VirtualMachineScaleSetSkuInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetSkuInner.class); + + /* + * The type of resource the sku applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The Sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /* + * Specifies the number of virtual machines in the scale set. + */ + @JsonProperty(value = "capacity", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineScaleSetSkuCapacity capacity; + + /** + * Get the resourceType property: The type of resource the sku applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the sku property: The Sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the capacity property: Specifies the number of virtual machines in the scale set. + * + * @return the capacity value. + */ + public VirtualMachineScaleSetSkuCapacity capacity() { + return this.capacity; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (capacity() != null) { + capacity().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateIpConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateIpConfigurationProperties.java new file mode 100644 index 0000000000000..95f74ae7017ef --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateIpConfigurationProperties.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdatePublicIpAddressConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's IP configuration properties. */ +@Fluent +public final class VirtualMachineScaleSetUpdateIpConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateIpConfigurationProperties.class); + + /* + * The subnet. + */ + @JsonProperty(value = "subnet") + private ApiEntityReference subnet; + + /* + * Specifies the primary IP Configuration in case the network interface has + * more than one IP Configuration. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * The publicIPAddressConfiguration. + */ + @JsonProperty(value = "publicIPAddressConfiguration") + private VirtualMachineScaleSetUpdatePublicIpAddressConfiguration publicIpAddressConfiguration; + + /* + * Available from Api-Version 2017-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. + */ + @JsonProperty(value = "privateIPAddressVersion") + private IpVersion privateIpAddressVersion; + + /* + * The application gateway backend address pools. + */ + @JsonProperty(value = "applicationGatewayBackendAddressPools") + private List applicationGatewayBackendAddressPools; + + /* + * Specifies an array of references to application security group. + */ + @JsonProperty(value = "applicationSecurityGroups") + private List applicationSecurityGroups; + + /* + * The load balancer backend address pools. + */ + @JsonProperty(value = "loadBalancerBackendAddressPools") + private List loadBalancerBackendAddressPools; + + /* + * The load balancer inbound nat pools. + */ + @JsonProperty(value = "loadBalancerInboundNatPools") + private List loadBalancerInboundNatPools; + + /** + * Get the subnet property: The subnet. + * + * @return the subnet value. + */ + public ApiEntityReference subnet() { + return this.subnet; + } + + /** + * Set the subnet property: The subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withSubnet(ApiEntityReference subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the primary property: Specifies the primary IP Configuration in case the network interface has more than one + * IP Configuration. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary IP Configuration in case the network interface has more than one + * IP Configuration. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.publicIpAddressConfiguration; + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withPublicIpAddressConfiguration( + VirtualMachineScaleSetUpdatePublicIpAddressConfiguration publicIpAddressConfiguration) { + this.publicIpAddressConfiguration = publicIpAddressConfiguration; + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersion privateIpAddressVersion() { + return this.privateIpAddressVersion; + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withPrivateIpAddressVersion( + IpVersion privateIpAddressVersion) { + this.privateIpAddressVersion = privateIpAddressVersion; + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: The application gateway backend address pools. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.applicationGatewayBackendAddressPools; + } + + /** + * Set the applicationGatewayBackendAddressPools property: The application gateway backend address pools. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + this.applicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.applicationSecurityGroups; + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withApplicationSecurityGroups( + List applicationSecurityGroups) { + this.applicationSecurityGroups = applicationSecurityGroups; + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: The load balancer backend address pools. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.loadBalancerBackendAddressPools; + } + + /** + * Set the loadBalancerBackendAddressPools property: The load balancer backend address pools. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + this.loadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + return this; + } + + /** + * Get the loadBalancerInboundNatPools property: The load balancer inbound nat pools. + * + * @return the loadBalancerInboundNatPools value. + */ + public List loadBalancerInboundNatPools() { + return this.loadBalancerInboundNatPools; + } + + /** + * Set the loadBalancerInboundNatPools property: The load balancer inbound nat pools. + * + * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateIpConfigurationProperties withLoadBalancerInboundNatPools( + List loadBalancerInboundNatPools) { + this.loadBalancerInboundNatPools = loadBalancerInboundNatPools; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnet() != null) { + subnet().validate(); + } + if (publicIpAddressConfiguration() != null) { + publicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateNetworkConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateNetworkConfigurationProperties.java new file mode 100644 index 0000000000000..09cd4edc93d7c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateNetworkConfigurationProperties.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateIpConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes a virtual machine scale set updatable network profile's IP configuration.Use this object for updating + * network profile's IP Configuration. + */ +@Fluent +public final class VirtualMachineScaleSetUpdateNetworkConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetUpdateNetworkConfigurationProperties.class); + + /* + * Whether this is a primary NIC on a virtual machine. + */ + @JsonProperty(value = "primary") + private Boolean primary; + + /* + * Specifies whether the network interface is accelerated + * networking-enabled. + */ + @JsonProperty(value = "enableAcceleratedNetworking") + private Boolean enableAcceleratedNetworking; + + /* + * Specifies whether the network interface is FPGA networking-enabled. + */ + @JsonProperty(value = "enableFpga") + private Boolean enableFpga; + + /* + * The network security group. + */ + @JsonProperty(value = "networkSecurityGroup") + private SubResource networkSecurityGroup; + + /* + * The dns settings to be applied on the network interfaces. + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings; + + /* + * The virtual machine scale set IP Configuration. + */ + @JsonProperty(value = "ipConfigurations") + private List ipConfigurations; + + /* + * Whether IP forwarding enabled on this NIC. + */ + @JsonProperty(value = "enableIPForwarding") + private Boolean enableIpForwarding; + + /* + * Specify what happens to the network interface when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /** + * Get the primary property: Whether this is a primary NIC on a virtual machine. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Whether this is a primary NIC on a virtual machine. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.enableAcceleratedNetworking; + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + this.enableAcceleratedNetworking = enableAcceleratedNetworking; + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.enableFpga; + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withEnableFpga(Boolean enableFpga) { + this.enableFpga = enableFpga; + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withNetworkSecurityGroup( + SubResource networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withDnsSettings( + VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipConfigurations property: The virtual machine scale set IP Configuration. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.ipConfigurations; + } + + /** + * Set the ipConfigurations property: The virtual machine scale set IP Configuration. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withIpConfigurations( + List ipConfigurations) { + this.ipConfigurations = ipConfigurations; + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.enableIpForwarding; + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withEnableIpForwarding( + Boolean enableIpForwarding) { + this.enableIpForwarding = enableIpForwarding; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipConfigurations() != null) { + ipConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateProperties.java new file mode 100644 index 0000000000000..1afdb5404ebbf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdateProperties.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateVMProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Virtual Machine Scale Set. */ +@Fluent +public final class VirtualMachineScaleSetUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateProperties.class); + + /* + * The upgrade policy. + */ + @JsonProperty(value = "upgradePolicy") + private UpgradePolicy upgradePolicy; + + /* + * Policy for automatic repairs. + */ + @JsonProperty(value = "automaticRepairsPolicy") + private AutomaticRepairsPolicy automaticRepairsPolicy; + + /* + * The virtual machine profile. + */ + @JsonProperty(value = "virtualMachineProfile") + private VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile; + + /* + * Specifies whether the Virtual Machine Scale Set should be + * overprovisioned. + */ + @JsonProperty(value = "overprovision") + private Boolean overprovision; + + /* + * When Overprovision is enabled, extensions are launched only on the + * requested number of VMs which are finally kept. This property will hence + * ensure that the extensions do not run on the extra overprovisioned VMs. + */ + @JsonProperty(value = "doNotRunExtensionsOnOverprovisionedVMs") + private Boolean doNotRunExtensionsOnOverprovisionedVMs; + + /* + * When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may + * be modified to false. However, if singlePlacementGroup is false, it may + * not be modified to true. + */ + @JsonProperty(value = "singlePlacementGroup") + private Boolean singlePlacementGroup; + + /* + * Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the + * Virtual Machines have the capability to support attaching managed data + * disks with UltraSSD_LRS storage account type. + */ + @JsonProperty(value = "additionalCapabilities") + private AdditionalCapabilities additionalCapabilities; + + /* + * Specifies the policies applied when scaling in Virtual Machines in the + * Virtual Machine Scale Set. + */ + @JsonProperty(value = "scaleInPolicy") + private ScaleInPolicy scaleInPolicy; + + /* + * Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to.

    Minimum + * api-version: 2018-04-01. + */ + @JsonProperty(value = "proximityPlacementGroup") + private SubResource proximityPlacementGroup; + + /** + * Get the upgradePolicy property: The upgrade policy. + * + * @return the upgradePolicy value. + */ + public UpgradePolicy upgradePolicy() { + return this.upgradePolicy; + } + + /** + * Set the upgradePolicy property: The upgrade policy. + * + * @param upgradePolicy the upgradePolicy value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withUpgradePolicy(UpgradePolicy upgradePolicy) { + this.upgradePolicy = upgradePolicy; + return this; + } + + /** + * Get the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @return the automaticRepairsPolicy value. + */ + public AutomaticRepairsPolicy automaticRepairsPolicy() { + return this.automaticRepairsPolicy; + } + + /** + * Set the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @param automaticRepairsPolicy the automaticRepairsPolicy value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withAutomaticRepairsPolicy( + AutomaticRepairsPolicy automaticRepairsPolicy) { + this.automaticRepairsPolicy = automaticRepairsPolicy; + return this; + } + + /** + * Get the virtualMachineProfile property: The virtual machine profile. + * + * @return the virtualMachineProfile value. + */ + public VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile() { + return this.virtualMachineProfile; + } + + /** + * Set the virtualMachineProfile property: The virtual machine profile. + * + * @param virtualMachineProfile the virtualMachineProfile value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withVirtualMachineProfile( + VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile) { + this.virtualMachineProfile = virtualMachineProfile; + return this; + } + + /** + * Get the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @return the overprovision value. + */ + public Boolean overprovision() { + return this.overprovision; + } + + /** + * Set the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @param overprovision the overprovision value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withOverprovision(Boolean overprovision) { + this.overprovision = overprovision; + return this; + } + + /** + * Get the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @return the doNotRunExtensionsOnOverprovisionedVMs value. + */ + public Boolean doNotRunExtensionsOnOverprovisionedVMs() { + return this.doNotRunExtensionsOnOverprovisionedVMs; + } + + /** + * Set the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @param doNotRunExtensionsOnOverprovisionedVMs the doNotRunExtensionsOnOverprovisionedVMs value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withDoNotRunExtensionsOnOverprovisionedVMs( + Boolean doNotRunExtensionsOnOverprovisionedVMs) { + this.doNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; + return this; + } + + /** + * Get the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @return the singlePlacementGroup value. + */ + public Boolean singlePlacementGroup() { + return this.singlePlacementGroup; + } + + /** + * Set the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @param singlePlacementGroup the singlePlacementGroup value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withSinglePlacementGroup(Boolean singlePlacementGroup) { + this.singlePlacementGroup = singlePlacementGroup; + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.additionalCapabilities; + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withAdditionalCapabilities( + AdditionalCapabilities additionalCapabilities) { + this.additionalCapabilities = additionalCapabilities; + return this; + } + + /** + * Get the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @return the scaleInPolicy value. + */ + public ScaleInPolicy scaleInPolicy() { + return this.scaleInPolicy; + } + + /** + * Set the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @param scaleInPolicy the scaleInPolicy value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withScaleInPolicy(ScaleInPolicy scaleInPolicy) { + this.scaleInPolicy = scaleInPolicy; + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.proximityPlacementGroup; + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineScaleSetUpdateProperties object itself. + */ + public VirtualMachineScaleSetUpdateProperties withProximityPlacementGroup(SubResource proximityPlacementGroup) { + this.proximityPlacementGroup = proximityPlacementGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (upgradePolicy() != null) { + upgradePolicy().validate(); + } + if (automaticRepairsPolicy() != null) { + automaticRepairsPolicy().validate(); + } + if (virtualMachineProfile() != null) { + virtualMachineProfile().validate(); + } + if (additionalCapabilities() != null) { + additionalCapabilities().validate(); + } + if (scaleInPolicy() != null) { + scaleInPolicy().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties.java new file mode 100644 index 0000000000000..c662270045325 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties.class); + + /* + * The idle timeout of the public IP address. + */ + @JsonProperty(value = "idleTimeoutInMinutes") + private Integer idleTimeoutInMinutes; + + /* + * The dns settings to be applied on the publicIP addresses . + */ + @JsonProperty(value = "dnsSettings") + private VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings; + + /* + * The PublicIPPrefix from which to allocate publicIP addresses. + */ + @JsonProperty(value = "publicIPPrefix") + private SubResource publicIpPrefix; + + /* + * Specify what happens to the public IP when the VM is deleted + */ + @JsonProperty(value = "deleteOption") + private DeleteOptions deleteOption; + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.idleTimeoutInMinutes; + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties withIdleTimeoutInMinutes( + Integer idleTimeoutInMinutes) { + this.idleTimeoutInMinutes = idleTimeoutInMinutes; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties withDnsSettings( + VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.publicIpPrefix; + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties withPublicIpPrefix( + SubResource publicIpPrefix) { + this.publicIpPrefix = publicIpPrefix; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties withDeleteOption( + DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionInner.java new file mode 100644 index 0000000000000..036ac6ec36adc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionInner.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a VMSS VM Extension. */ +@Fluent +public final class VirtualMachineScaleSetVMExtensionInner extends SubResourceReadOnly { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionInner.class); + + /* + * The name of the extension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Describes the properties of a Virtual Machine Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineExtensionProperties innerProperties; + + /** + * Get the name property: The name of the extension. + * + * @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: Describes the properties of a Virtual Machine Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine extension instance view. + * + * @return the instanceView value. + */ + public VirtualMachineExtensionInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Set the instanceView property: The virtual machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withInstanceView(VirtualMachineExtensionInstanceView instanceView) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withInstanceView(instanceView); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetVMExtensionInner object itself. + */ + public VirtualMachineScaleSetVMExtensionInner withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionsListResultInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionsListResultInner.java new file mode 100644 index 0000000000000..b8aa3e3eedbd1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMExtensionsListResultInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List VMSS VM Extension operation response. */ +@Fluent +public final class VirtualMachineScaleSetVMExtensionsListResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionsListResultInner.class); + + /* + * The list of VMSS VM extensions + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of VMSS VM extensions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of VMSS VM extensions. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetVMExtensionsListResultInner object itself. + */ + public VirtualMachineScaleSetVMExtensionsListResultInner withValue( + List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInner.java new file mode 100644 index 0000000000000..a1f83257f3a06 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInner.java @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Describes a virtual machine scale set virtual machine. */ +@Fluent +public final class VirtualMachineScaleSetVMInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMInner.class); + + /* + * The virtual machine instance ID. + */ + @JsonProperty(value = "instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /* + * The virtual machine SKU. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /* + * Describes the properties of a virtual machine scale set virtual machine. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetVMPropertiesInner innerProperties; + + /* + * Specifies information about the marketplace image used to create the + * virtual machine. This element is only used for marketplace images. + * Before you can use a marketplace image from an API, you must enable the + * image for programmatic use. In the Azure portal, find the marketplace + * image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information and + * then click **Save**. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * The virtual machine child extension resources. + */ + @JsonProperty(value = "resources", access = JsonProperty.Access.WRITE_ONLY) + private List resources; + + /* + * The virtual machine zones. + */ + @JsonProperty(value = "zones", access = JsonProperty.Access.WRITE_ONLY) + private List zones; + + /** + * Get the instanceId property: The virtual machine instance ID. + * + * @return the instanceId value. + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the sku property: The virtual machine SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the innerProperties property: Describes the properties of a virtual machine scale set virtual machine. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetVMPropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @param plan the plan value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the resources property: The virtual machine child extension resources. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Get the zones property: The virtual machine zones. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetVMInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetVMInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the latestModelApplied property: Specifies whether the latest model has been applied to the virtual machine. + * + * @return the latestModelApplied value. + */ + public Boolean latestModelApplied() { + return this.innerProperties() == null ? null : this.innerProperties().latestModelApplied(); + } + + /** + * Get the vmId property: Azure VM unique ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.innerProperties() == null ? null : this.innerProperties().vmId(); + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineScaleSetVMInstanceViewInner instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile(); + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withHardwareProfile(HardwareProfile hardwareProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withHardwareProfile(hardwareProfile); + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withStorageProfile(StorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities(); + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withAdditionalCapabilities(additionalCapabilities); + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.innerProperties() == null ? null : this.innerProperties().osProfile(); + } + + /** + * Set the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withOsProfile(OSProfile osProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withOsProfile(osProfile); + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().securityProfile(); + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withSecurityProfile(SecurityProfile securityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withSecurityProfile(securityProfile); + return this; + } + + /** + * Get the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfile(); + } + + /** + * Set the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withNetworkProfile(NetworkProfile networkProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withNetworkProfile(networkProfile); + return this; + } + + /** + * Get the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine. + * + * @return the networkProfileConfiguration value. + */ + public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfileConfiguration(); + } + + /** + * Set the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine. + * + * @param networkProfileConfiguration the networkProfileConfiguration value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withNetworkProfileConfiguration( + VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withNetworkProfileConfiguration(networkProfileConfiguration); + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticsProfile(); + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withDiagnosticsProfile(diagnosticsProfile); + return this; + } + + /** + * Get the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @return the availabilitySet value. + */ + public SubResource availabilitySet() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySet(); + } + + /** + * Set the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @param availabilitySet the availabilitySet value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withAvailabilitySet(SubResource availabilitySet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withAvailabilitySet(availabilitySet); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withLicenseType(String licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the modelDefinitionApplied property: Specifies whether the model applied to the virtual machine is the model + * of the virtual machine scale set or the customized model for the virtual machine. + * + * @return the modelDefinitionApplied value. + */ + public String modelDefinitionApplied() { + return this.innerProperties() == null ? null : this.innerProperties().modelDefinitionApplied(); + } + + /** + * Get the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @return the protectionPolicy value. + */ + public VirtualMachineScaleSetVMProtectionPolicy protectionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().protectionPolicy(); + } + + /** + * Set the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @param protectionPolicy the protectionPolicy value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withProtectionPolicy( + VirtualMachineScaleSetVMProtectionPolicy protectionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withProtectionPolicy(protectionPolicy); + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.innerProperties() == null ? null : this.innerProperties().userData(); + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineScaleSetVMInner object itself. + */ + public VirtualMachineScaleSetVMInner withUserData(String userData) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetVMPropertiesInner(); + } + this.innerProperties().withUserData(userData); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (resources() != null) { + resources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInstanceViewInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInstanceViewInner.java new file mode 100644 index 0000000000000..f3d4035189a37 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMInstanceViewInner.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.BootDiagnosticsInstanceView; +import com.azure.resourcemanager.compute.generated.models.DiskInstanceView; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.MaintenanceRedeployStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAgentInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineHealthStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a virtual machine scale set VM. */ +@Fluent +public final class VirtualMachineScaleSetVMInstanceViewInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMInstanceViewInner.class); + + /* + * The Update Domain count. + */ + @JsonProperty(value = "platformUpdateDomain") + private Integer platformUpdateDomain; + + /* + * The Fault Domain count. + */ + @JsonProperty(value = "platformFaultDomain") + private Integer platformFaultDomain; + + /* + * The Remote desktop certificate thumbprint. + */ + @JsonProperty(value = "rdpThumbPrint") + private String rdpThumbPrint; + + /* + * The VM Agent running on the virtual machine. + */ + @JsonProperty(value = "vmAgent") + private VirtualMachineAgentInstanceView vmAgent; + + /* + * The Maintenance Operation status on the virtual machine. + */ + @JsonProperty(value = "maintenanceRedeployStatus") + private MaintenanceRedeployStatus maintenanceRedeployStatus; + + /* + * The disks information. + */ + @JsonProperty(value = "disks") + private List disks; + + /* + * The extensions information. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /* + * The health status for the VM. + */ + @JsonProperty(value = "vmHealth", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineHealthStatus vmHealth; + + /* + * Boot Diagnostics is a debugging feature which allows you to view Console + * Output and Screenshot to diagnose VM status.

    You can easily + * view the output of your console log.

    Azure also enables you to + * see a screenshot of the VM from the hypervisor. + */ + @JsonProperty(value = "bootDiagnostics") + private BootDiagnosticsInstanceView bootDiagnostics; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /* + * Resource id of the dedicated host, on which the virtual machine is + * allocated through automatic placement, when the virtual machine is + * associated with a dedicated host group that has automatic placement + * enabled.

    Minimum api-version: 2020-06-01. + */ + @JsonProperty(value = "assignedHost", access = JsonProperty.Access.WRITE_ONLY) + private String assignedHost; + + /* + * The placement group in which the VM is running. If the VM is deallocated + * it will not have a placementGroupId. + */ + @JsonProperty(value = "placementGroupId") + private String placementGroupId; + + /** + * Get the platformUpdateDomain property: The Update Domain count. + * + * @return the platformUpdateDomain value. + */ + public Integer platformUpdateDomain() { + return this.platformUpdateDomain; + } + + /** + * Set the platformUpdateDomain property: The Update Domain count. + * + * @param platformUpdateDomain the platformUpdateDomain value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withPlatformUpdateDomain(Integer platformUpdateDomain) { + this.platformUpdateDomain = platformUpdateDomain; + return this; + } + + /** + * Get the platformFaultDomain property: The Fault Domain count. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.platformFaultDomain; + } + + /** + * Set the platformFaultDomain property: The Fault Domain count. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withPlatformFaultDomain(Integer platformFaultDomain) { + this.platformFaultDomain = platformFaultDomain; + return this; + } + + /** + * Get the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @return the rdpThumbPrint value. + */ + public String rdpThumbPrint() { + return this.rdpThumbPrint; + } + + /** + * Set the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @param rdpThumbPrint the rdpThumbPrint value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withRdpThumbPrint(String rdpThumbPrint) { + this.rdpThumbPrint = rdpThumbPrint; + return this; + } + + /** + * Get the vmAgent property: The VM Agent running on the virtual machine. + * + * @return the vmAgent value. + */ + public VirtualMachineAgentInstanceView vmAgent() { + return this.vmAgent; + } + + /** + * Set the vmAgent property: The VM Agent running on the virtual machine. + * + * @param vmAgent the vmAgent value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withVmAgent(VirtualMachineAgentInstanceView vmAgent) { + this.vmAgent = vmAgent; + return this; + } + + /** + * Get the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @return the maintenanceRedeployStatus value. + */ + public MaintenanceRedeployStatus maintenanceRedeployStatus() { + return this.maintenanceRedeployStatus; + } + + /** + * Set the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @param maintenanceRedeployStatus the maintenanceRedeployStatus value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withMaintenanceRedeployStatus( + MaintenanceRedeployStatus maintenanceRedeployStatus) { + this.maintenanceRedeployStatus = maintenanceRedeployStatus; + return this; + } + + /** + * Get the disks property: The disks information. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Set the disks property: The disks information. + * + * @param disks the disks value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withDisks(List disks) { + this.disks = disks; + return this; + } + + /** + * Get the extensions property: The extensions information. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: The extensions information. + * + * @param extensions the extensions value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withExtensions( + List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get the vmHealth property: The health status for the VM. + * + * @return the vmHealth value. + */ + public VirtualMachineHealthStatus vmHealth() { + return this.vmHealth; + } + + /** + * Get the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. + * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @return the bootDiagnostics value. + */ + public BootDiagnosticsInstanceView bootDiagnostics() { + return this.bootDiagnostics; + } + + /** + * Set the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. + * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @param bootDiagnostics the bootDiagnostics value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withBootDiagnostics(BootDiagnosticsInstanceView bootDiagnostics) { + this.bootDiagnostics = bootDiagnostics; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get the assignedHost property: Resource id of the dedicated host, on which the virtual machine is allocated + * through automatic placement, when the virtual machine is associated with a dedicated host group that has + * automatic placement enabled. <br><br>Minimum api-version: 2020-06-01. + * + * @return the assignedHost value. + */ + public String assignedHost() { + return this.assignedHost; + } + + /** + * Get the placementGroupId property: The placement group in which the VM is running. If the VM is deallocated it + * will not have a placementGroupId. + * + * @return the placementGroupId value. + */ + public String placementGroupId() { + return this.placementGroupId; + } + + /** + * Set the placementGroupId property: The placement group in which the VM is running. If the VM is deallocated it + * will not have a placementGroupId. + * + * @param placementGroupId the placementGroupId value to set. + * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. + */ + public VirtualMachineScaleSetVMInstanceViewInner withPlacementGroupId(String placementGroupId) { + this.placementGroupId = placementGroupId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmAgent() != null) { + vmAgent().validate(); + } + if (maintenanceRedeployStatus() != null) { + maintenanceRedeployStatus().validate(); + } + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + if (vmHealth() != null) { + vmHealth().validate(); + } + if (bootDiagnostics() != null) { + bootDiagnostics().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMPropertiesInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMPropertiesInner.java new file mode 100644 index 0000000000000..1c60cba47ee13 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineScaleSetVMPropertiesInner.java @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a virtual machine scale set virtual machine. */ +@Fluent +public final class VirtualMachineScaleSetVMPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMPropertiesInner.class); + + /* + * Specifies whether the latest model has been applied to the virtual + * machine. + */ + @JsonProperty(value = "latestModelApplied", access = JsonProperty.Access.WRITE_ONLY) + private Boolean latestModelApplied; + + /* + * Azure VM unique ID. + */ + @JsonProperty(value = "vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /* + * The virtual machine instance view. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineScaleSetVMInstanceViewInner instanceView; + + /* + * Specifies the hardware settings for the virtual machine. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /* + * Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has + * the capability to support attaching managed data disks with UltraSSD_LRS + * storage account type. + */ + @JsonProperty(value = "additionalCapabilities") + private AdditionalCapabilities additionalCapabilities; + + /* + * Specifies the operating system settings for the virtual machine. + */ + @JsonProperty(value = "osProfile") + private OSProfile osProfile; + + /* + * Specifies the Security related profile settings for the virtual machine. + */ + @JsonProperty(value = "securityProfile") + private SecurityProfile securityProfile; + + /* + * Specifies the network interfaces of the virtual machine. + */ + @JsonProperty(value = "networkProfile") + private NetworkProfile networkProfile; + + /* + * Specifies the network profile configuration of the virtual machine. + */ + @JsonProperty(value = "networkProfileConfiguration") + private VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration; + + /* + * Specifies the boot diagnostic settings state.

    Minimum + * api-version: 2015-06-15. + */ + @JsonProperty(value = "diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /* + * Specifies information about the availability set that the virtual + * machine should be assigned to. Virtual machines specified in the same + * availability set are allocated to different nodes to maximize + * availability. For more information about availability sets, see + * [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + *

    For more information on Azure planned maintenance, see + * [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + *

    Currently, a VM can only be added to availability set at + * creation time. An existing VM cannot be added to an availability set. + */ + @JsonProperty(value = "availabilitySet") + private SubResource availabilitySet; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Specifies that the image or disk that is being used was licensed + * on-premises.

    Possible values for Windows Server operating + * system are:

    Windows_Client

    Windows_Server

    + * Possible values for Linux Server operating system are:

    + * RHEL_BYOS (for RHEL)

    SLES_BYOS (for SUSE)

    For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + *

    [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + *

    Minimum api-version: 2015-06-15 + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * Specifies whether the model applied to the virtual machine is the model + * of the virtual machine scale set or the customized model for the virtual + * machine. + */ + @JsonProperty(value = "modelDefinitionApplied", access = JsonProperty.Access.WRITE_ONLY) + private String modelDefinitionApplied; + + /* + * Specifies the protection policy of the virtual machine. + */ + @JsonProperty(value = "protectionPolicy") + private VirtualMachineScaleSetVMProtectionPolicy protectionPolicy; + + /* + * UserData for the VM, which must be base-64 encoded. Customer should not + * pass any secrets in here.

    Minimum api-version: 2021-03-01 + */ + @JsonProperty(value = "userData") + private String userData; + + /** + * Get the latestModelApplied property: Specifies whether the latest model has been applied to the virtual machine. + * + * @return the latestModelApplied value. + */ + public Boolean latestModelApplied() { + return this.latestModelApplied; + } + + /** + * Get the vmId property: Azure VM unique ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineScaleSetVMInstanceViewInner instanceView() { + return this.instanceView; + } + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.additionalCapabilities; + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withAdditionalCapabilities( + AdditionalCapabilities additionalCapabilities) { + this.additionalCapabilities = additionalCapabilities; + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine. + * + * @return the networkProfileConfiguration value. + */ + public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration() { + return this.networkProfileConfiguration; + } + + /** + * Set the networkProfileConfiguration property: Specifies the network profile configuration of the virtual machine. + * + * @param networkProfileConfiguration the networkProfileConfiguration value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withNetworkProfileConfiguration( + VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration) { + this.networkProfileConfiguration = networkProfileConfiguration; + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @return the availabilitySet value. + */ + public SubResource availabilitySet() { + return this.availabilitySet; + } + + /** + * Set the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @param availabilitySet the availabilitySet value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withAvailabilitySet(SubResource availabilitySet) { + this.availabilitySet = availabilitySet; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the modelDefinitionApplied property: Specifies whether the model applied to the virtual machine is the model + * of the virtual machine scale set or the customized model for the virtual machine. + * + * @return the modelDefinitionApplied value. + */ + public String modelDefinitionApplied() { + return this.modelDefinitionApplied; + } + + /** + * Get the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @return the protectionPolicy value. + */ + public VirtualMachineScaleSetVMProtectionPolicy protectionPolicy() { + return this.protectionPolicy; + } + + /** + * Set the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @param protectionPolicy the protectionPolicy value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withProtectionPolicy( + VirtualMachineScaleSetVMProtectionPolicy protectionPolicy) { + this.protectionPolicy = protectionPolicy; + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.userData; + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineScaleSetVMPropertiesInner object itself. + */ + public VirtualMachineScaleSetVMPropertiesInner withUserData(String userData) { + this.userData = userData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceView() != null) { + instanceView().validate(); + } + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (additionalCapabilities() != null) { + additionalCapabilities().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (networkProfileConfiguration() != null) { + networkProfileConfiguration().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (protectionPolicy() != null) { + protectionPolicy().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineSizeInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineSizeInner.java new file mode 100644 index 0000000000000..5eb8e65f1e503 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineSizeInner.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a VM size. */ +@Fluent +public final class VirtualMachineSizeInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineSizeInner.class); + + /* + * The name of the virtual machine size. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The number of cores supported by the virtual machine size. For + * Constrained vCPU capable VM sizes, this number represents the total + * vCPUs of quota that the VM uses. For accurate vCPU count, please refer + * to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + * https://docs.microsoft.com/rest/api/compute/resourceskus/list + */ + @JsonProperty(value = "numberOfCores") + private Integer numberOfCores; + + /* + * The OS disk size, in MB, allowed by the virtual machine size. + */ + @JsonProperty(value = "osDiskSizeInMB") + private Integer osDiskSizeInMB; + + /* + * The resource disk size, in MB, allowed by the virtual machine size. + */ + @JsonProperty(value = "resourceDiskSizeInMB") + private Integer resourceDiskSizeInMB; + + /* + * The amount of memory, in MB, supported by the virtual machine size. + */ + @JsonProperty(value = "memoryInMB") + private Integer memoryInMB; + + /* + * The maximum number of data disks that can be attached to the virtual + * machine size. + */ + @JsonProperty(value = "maxDataDiskCount") + private Integer maxDataDiskCount; + + /** + * Get the name property: The name of the virtual machine size. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the virtual machine size. + * + * @param name the name value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the numberOfCores property: The number of cores supported by the virtual machine size. For Constrained vCPU + * capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, + * please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + * https://docs.microsoft.com/rest/api/compute/resourceskus/list. + * + * @return the numberOfCores value. + */ + public Integer numberOfCores() { + return this.numberOfCores; + } + + /** + * Set the numberOfCores property: The number of cores supported by the virtual machine size. For Constrained vCPU + * capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, + * please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + * https://docs.microsoft.com/rest/api/compute/resourceskus/list. + * + * @param numberOfCores the numberOfCores value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withNumberOfCores(Integer numberOfCores) { + this.numberOfCores = numberOfCores; + return this; + } + + /** + * Get the osDiskSizeInMB property: The OS disk size, in MB, allowed by the virtual machine size. + * + * @return the osDiskSizeInMB value. + */ + public Integer osDiskSizeInMB() { + return this.osDiskSizeInMB; + } + + /** + * Set the osDiskSizeInMB property: The OS disk size, in MB, allowed by the virtual machine size. + * + * @param osDiskSizeInMB the osDiskSizeInMB value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withOsDiskSizeInMB(Integer osDiskSizeInMB) { + this.osDiskSizeInMB = osDiskSizeInMB; + return this; + } + + /** + * Get the resourceDiskSizeInMB property: The resource disk size, in MB, allowed by the virtual machine size. + * + * @return the resourceDiskSizeInMB value. + */ + public Integer resourceDiskSizeInMB() { + return this.resourceDiskSizeInMB; + } + + /** + * Set the resourceDiskSizeInMB property: The resource disk size, in MB, allowed by the virtual machine size. + * + * @param resourceDiskSizeInMB the resourceDiskSizeInMB value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withResourceDiskSizeInMB(Integer resourceDiskSizeInMB) { + this.resourceDiskSizeInMB = resourceDiskSizeInMB; + return this; + } + + /** + * Get the memoryInMB property: The amount of memory, in MB, supported by the virtual machine size. + * + * @return the memoryInMB value. + */ + public Integer memoryInMB() { + return this.memoryInMB; + } + + /** + * Set the memoryInMB property: The amount of memory, in MB, supported by the virtual machine size. + * + * @param memoryInMB the memoryInMB value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withMemoryInMB(Integer memoryInMB) { + this.memoryInMB = memoryInMB; + return this; + } + + /** + * Get the maxDataDiskCount property: The maximum number of data disks that can be attached to the virtual machine + * size. + * + * @return the maxDataDiskCount value. + */ + public Integer maxDataDiskCount() { + return this.maxDataDiskCount; + } + + /** + * Set the maxDataDiskCount property: The maximum number of data disks that can be attached to the virtual machine + * size. + * + * @param maxDataDiskCount the maxDataDiskCount value to set. + * @return the VirtualMachineSizeInner object itself. + */ + public VirtualMachineSizeInner withMaxDataDiskCount(Integer maxDataDiskCount) { + this.maxDataDiskCount = maxDataDiskCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineUpdateInner.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineUpdateInner.java new file mode 100644 index 0000000000000..ff9cadf9ed0d8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/VirtualMachineUpdateInner.java @@ -0,0 +1,803 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.UpdateResource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine Update. */ +@Fluent +public final class VirtualMachineUpdateInner extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineUpdateInner.class); + + /* + * Specifies information about the marketplace image used to create the + * virtual machine. This element is only used for marketplace images. + * Before you can use a marketplace image from an API, you must enable the + * image for programmatic use. In the Azure portal, find the marketplace + * image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information and + * then click **Save**. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * Describes the properties of a Virtual Machine. + */ + @JsonProperty(value = "properties") + private VirtualMachinePropertiesInner innerProperties; + + /* + * The identity of the virtual machine, if configured. + */ + @JsonProperty(value = "identity") + private VirtualMachineIdentity identity; + + /* + * The virtual machine zones. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + * the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then + * click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @param plan the plan value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine. + * + * @return the innerProperties value. + */ + private VirtualMachinePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The identity of the virtual machine, if configured. + * + * @return the identity value. + */ + public VirtualMachineIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the virtual machine, if configured. + * + * @param identity the identity value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withIdentity(VirtualMachineIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the zones property: The virtual machine zones. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The virtual machine zones. + * + * @param zones the zones value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineUpdateInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile(); + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withHardwareProfile(HardwareProfile hardwareProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHardwareProfile(hardwareProfile); + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withStorageProfile(StorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities(); + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withAdditionalCapabilities(additionalCapabilities); + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.innerProperties() == null ? null : this.innerProperties().osProfile(); + } + + /** + * Set the osProfile property: Specifies the operating system settings used while creating the virtual machine. Some + * of the settings cannot be changed once VM is provisioned. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withOsProfile(OSProfile osProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withOsProfile(osProfile); + return this; + } + + /** + * Get the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfile(); + } + + /** + * Set the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withNetworkProfile(NetworkProfile networkProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withNetworkProfile(networkProfile); + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().securityProfile(); + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withSecurityProfile(SecurityProfile securityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withSecurityProfile(securityProfile); + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().diagnosticsProfile(); + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withDiagnosticsProfile(diagnosticsProfile); + return this; + } + + /** + * Get the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + public SubResource availabilitySet() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySet(); + } + + /** + * Set the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @param availabilitySet the availabilitySet value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withAvailabilitySet(SubResource availabilitySet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withAvailabilitySet(availabilitySet); + return this; + } + + /** + * Get the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + public SubResource virtualMachineScaleSet() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineScaleSet(); + } + + /** + * Set the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @param virtualMachineScaleSet the virtualMachineScaleSet value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withVirtualMachineScaleSet(SubResource virtualMachineScaleSet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withVirtualMachineScaleSet(virtualMachineScaleSet); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Get the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + public VirtualMachinePriorityTypes priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @param priority the priority value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withPriority(VirtualMachinePriorityTypes priority) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * Get the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().evictionPolicy(); + } + + /** + * Set the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @param evictionPolicy the evictionPolicy value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withEvictionPolicy(evictionPolicy); + return this; + } + + /** + * Get the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + public BillingProfile billingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().billingProfile(); + } + + /** + * Set the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param billingProfile the billingProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withBillingProfile(BillingProfile billingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withBillingProfile(billingProfile); + return this; + } + + /** + * Get the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + public SubResource host() { + return this.innerProperties() == null ? null : this.innerProperties().host(); + } + + /** + * Set the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @param host the host value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withHost(SubResource host) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHost(host); + return this; + } + + /** + * Get the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @return the hostGroup value. + */ + public SubResource hostGroup() { + return this.innerProperties() == null ? null : this.innerProperties().hostGroup(); + } + + /** + * Set the hostGroup property: Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host + * and hostGroup properties. + * + * @param hostGroup the hostGroup value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withHostGroup(SubResource hostGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withHostGroup(hostGroup); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineInstanceViewInner instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withLicenseType(String licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + public String vmId() { + return this.innerProperties() == null ? null : this.innerProperties().vmId(); + } + + /** + * Get the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + public String extensionsTimeBudget() { + return this.innerProperties() == null ? null : this.innerProperties().extensionsTimeBudget(); + } + + /** + * Set the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @param extensionsTimeBudget the extensionsTimeBudget value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withExtensionsTimeBudget(String extensionsTimeBudget) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withExtensionsTimeBudget(extensionsTimeBudget); + return this; + } + + /** + * Get the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomain(); + } + + /** + * Set the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best + * maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withPlatformFaultDomain(Integer platformFaultDomain) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withPlatformFaultDomain(platformFaultDomain); + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().scheduledEventsProfile(); + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withScheduledEventsProfile(scheduledEventsProfile); + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.innerProperties() == null ? null : this.innerProperties().userData(); + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withUserData(String userData) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withUserData(userData); + return this; + } + + /** + * Get the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + public CapacityReservationProfile capacityReservation() { + return this.innerProperties() == null ? null : this.innerProperties().capacityReservation(); + } + + /** + * Set the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @param capacityReservation the capacityReservation value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withCapacityReservation(CapacityReservationProfile capacityReservation) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withCapacityReservation(capacityReservation); + return this; + } + + /** + * Get the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + public ApplicationProfile applicationProfile() { + return this.innerProperties() == null ? null : this.innerProperties().applicationProfile(); + } + + /** + * Set the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param applicationProfile the applicationProfile value to set. + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withApplicationProfile(ApplicationProfile applicationProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePropertiesInner(); + } + this.innerProperties().withApplicationProfile(applicationProfile); + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (plan() != null) { + plan().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/package-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..12c6f19064121 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for ComputeManagementClient. Compute Client. */ +package com.azure.resourcemanager.compute.generated.fluent.models; diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/package-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/package-info.java new file mode 100644 index 0000000000000..a1fd21a378b14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for ComputeManagementClient. Compute Client. */ +package com.azure.resourcemanager.compute.generated.fluent; diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AccessUriImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AccessUriImpl.java new file mode 100644 index 0000000000000..0679353c22d73 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AccessUriImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; + +public final class AccessUriImpl implements AccessUri { + private AccessUriInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + AccessUriImpl( + AccessUriInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String accessSas() { + return this.innerModel().accessSas(); + } + + public String securityDataAccessSas() { + return this.innerModel().securityDataAccessSas(); + } + + public AccessUriInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetImpl.java new file mode 100644 index 0000000000000..b0947d076bc48 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetImpl.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySet; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySetUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AvailabilitySetImpl implements AvailabilitySet, AvailabilitySet.Definition, AvailabilitySet.Update { + private AvailabilitySetInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public Integer platformUpdateDomainCount() { + return this.innerModel().platformUpdateDomainCount(); + } + + public Integer platformFaultDomainCount() { + return this.innerModel().platformFaultDomainCount(); + } + + public List virtualMachines() { + List inner = this.innerModel().virtualMachines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SubResource proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AvailabilitySetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String availabilitySetName; + + private AvailabilitySetUpdate updateParameters; + + public AvailabilitySetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AvailabilitySet create() { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .createOrUpdateWithResponse(resourceGroupName, availabilitySetName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AvailabilitySet create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .createOrUpdateWithResponse(resourceGroupName, availabilitySetName, this.innerModel(), context) + .getValue(); + return this; + } + + AvailabilitySetImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new AvailabilitySetInner(); + this.serviceManager = serviceManager; + this.availabilitySetName = name; + } + + public AvailabilitySetImpl update() { + this.updateParameters = new AvailabilitySetUpdate(); + return this; + } + + public AvailabilitySet apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .updateWithResponse(resourceGroupName, availabilitySetName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public AvailabilitySet apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .updateWithResponse(resourceGroupName, availabilitySetName, updateParameters, context) + .getValue(); + return this; + } + + AvailabilitySetImpl( + AvailabilitySetInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.availabilitySetName = Utils.getValueFromIdByName(innerObject.id(), "availabilitySets"); + } + + public AvailabilitySet refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .getByResourceGroupWithResponse(resourceGroupName, availabilitySetName, Context.NONE) + .getValue(); + return this; + } + + public AvailabilitySet refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .getByResourceGroupWithResponse(resourceGroupName, availabilitySetName, context) + .getValue(); + return this; + } + + public AvailabilitySetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AvailabilitySetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AvailabilitySetImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public AvailabilitySetImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public AvailabilitySetImpl withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) { + if (isInCreateMode()) { + this.innerModel().withPlatformUpdateDomainCount(platformUpdateDomainCount); + return this; + } else { + this.updateParameters.withPlatformUpdateDomainCount(platformUpdateDomainCount); + return this; + } + } + + public AvailabilitySetImpl withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (isInCreateMode()) { + this.innerModel().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } else { + this.updateParameters.withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + } + + public AvailabilitySetImpl withVirtualMachines(List virtualMachines) { + if (isInCreateMode()) { + this.innerModel().withVirtualMachines(virtualMachines); + return this; + } else { + this.updateParameters.withVirtualMachines(virtualMachines); + return this; + } + } + + public AvailabilitySetImpl withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (isInCreateMode()) { + this.innerModel().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } else { + this.updateParameters.withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsClientImpl.java new file mode 100644 index 0000000000000..795d295fcaff4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsClientImpl.java @@ -0,0 +1,1503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySetListResult; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySetUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AvailabilitySetsClient. */ +public final class AvailabilitySetsClientImpl implements AvailabilitySetsClient { + private final ClientLogger logger = new ClientLogger(AvailabilitySetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AvailabilitySetsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of AvailabilitySetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AvailabilitySetsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(AvailabilitySetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientAvailabilitySets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface AvailabilitySetsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AvailabilitySetInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AvailabilitySetUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @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.Compute/availabilitySets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/availabilitySets/{availabilitySetName}/vmSizes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAvailableSizes( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @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(ApiErrorException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, availabilitySetName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters) { + return createOrUpdateAsync(resourceGroupName, availabilitySetName, parameters).block(); + } + + /** + * Create or update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Create Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, availabilitySetName, parameters, context).block(); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, availabilitySetName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner update( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters) { + return updateAsync(resourceGroupName, availabilitySetName, parameters).block(); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String availabilitySetName, AvailabilitySetUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, availabilitySetName, parameters, context).block(); + } + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 availabilitySetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 availabilitySetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 availabilitySetName) { + return deleteWithResponseAsync(resourceGroupName, availabilitySetName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 availabilitySetName) { + deleteAsync(resourceGroupName, availabilitySetName).block(); + } + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String availabilitySetName, Context context) { + return deleteWithResponseAsync(resourceGroupName, availabilitySetName, context).block(); + } + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String availabilitySetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String availabilitySetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String availabilitySetName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, availabilitySetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName) { + return getByResourceGroupAsync(resourceGroupName, availabilitySetName).block(); + } + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, availabilitySetName, context).block(); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + expand, + 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 availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all availability sets in a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(expand), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all availability sets in a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableSizesSinglePageAsync( + String resourceGroupName, String availabilitySetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAvailableSizes( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableSizesSinglePageAsync( + String resourceGroupName, String availabilitySetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAvailableSizes( + this.client.getEndpoint(), + resourceGroupName, + availabilitySetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAvailableSizesAsync( + String resourceGroupName, String availabilitySetName) { + return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, availabilitySetName)); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAvailableSizesAsync( + String resourceGroupName, String availabilitySetName, Context context) { + return new PagedFlux<>( + () -> listAvailableSizesSinglePageAsync(resourceGroupName, availabilitySetName, context)); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAvailableSizes( + String resourceGroupName, String availabilitySetName) { + return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, availabilitySetName)); + } + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAvailableSizes( + String resourceGroupName, String availabilitySetName, Context context) { + return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, availabilitySetName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsImpl.java new file mode 100644 index 0000000000000..d5fcb99e49f54 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/AvailabilitySetsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySet; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySets; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSize; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AvailabilitySetsImpl implements AvailabilitySets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilitySetsImpl.class); + + private final AvailabilitySetsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public AvailabilitySetsImpl( + AvailabilitySetsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String availabilitySetName) { + this.serviceClient().delete(resourceGroupName, availabilitySetName); + } + + public Response deleteWithResponse(String resourceGroupName, String availabilitySetName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, availabilitySetName, context); + } + + public AvailabilitySet getByResourceGroup(String resourceGroupName, String availabilitySetName) { + AvailabilitySetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, availabilitySetName); + if (inner != null) { + return new AvailabilitySetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, availabilitySetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AvailabilitySetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(inner1, this.manager())); + } + + public PagedIterable listAvailableSizes(String resourceGroupName, String availabilitySetName) { + PagedIterable inner = + this.serviceClient().listAvailableSizes(resourceGroupName, availabilitySetName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + public PagedIterable listAvailableSizes( + String resourceGroupName, String availabilitySetName, Context context) { + PagedIterable inner = + this.serviceClient().listAvailableSizes(resourceGroupName, availabilitySetName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + public AvailabilitySet getById(String id) { + String resourceGroupName = Utils.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 availabilitySetName = Utils.getValueFromIdByName(id, "availabilitySets"); + if (availabilitySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'availabilitySets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, availabilitySetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 availabilitySetName = Utils.getValueFromIdByName(id, "availabilitySets"); + if (availabilitySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'availabilitySets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, availabilitySetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 availabilitySetName = Utils.getValueFromIdByName(id, "availabilitySets"); + if (availabilitySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'availabilitySets'.", id))); + } + this.deleteWithResponse(resourceGroupName, availabilitySetName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 availabilitySetName = Utils.getValueFromIdByName(id, "availabilitySets"); + if (availabilitySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'availabilitySets'.", id))); + } + return this.deleteWithResponse(resourceGroupName, availabilitySetName, context); + } + + private AvailabilitySetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public AvailabilitySetImpl define(String name) { + return new AvailabilitySetImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupImpl.java new file mode 100644 index 0000000000000..31fe412b55f2d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroup; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CapacityReservationGroupImpl + implements CapacityReservationGroup, CapacityReservationGroup.Definition, CapacityReservationGroup.Update { + private CapacityReservationGroupInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List capacityReservations() { + List inner = this.innerModel().capacityReservations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List virtualMachinesAssociated() { + List inner = this.innerModel().virtualMachinesAssociated(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CapacityReservationGroupInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CapacityReservationGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String capacityReservationGroupName; + + private CapacityReservationGroupUpdate updateParameters; + + public CapacityReservationGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CapacityReservationGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .createOrUpdateWithResponse( + resourceGroupName, capacityReservationGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CapacityReservationGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .createOrUpdateWithResponse(resourceGroupName, capacityReservationGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + CapacityReservationGroupImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new CapacityReservationGroupInner(); + this.serviceManager = serviceManager; + this.capacityReservationGroupName = name; + } + + public CapacityReservationGroupImpl update() { + this.updateParameters = new CapacityReservationGroupUpdate(); + return this; + } + + public CapacityReservationGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .updateWithResponse(resourceGroupName, capacityReservationGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public CapacityReservationGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .updateWithResponse(resourceGroupName, capacityReservationGroupName, updateParameters, context) + .getValue(); + return this; + } + + CapacityReservationGroupImpl( + CapacityReservationGroupInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.capacityReservationGroupName = Utils.getValueFromIdByName(innerObject.id(), "capacityReservationGroups"); + } + + public CapacityReservationGroup refresh() { + CapacityReservationGroupInstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .getByResourceGroupWithResponse( + resourceGroupName, capacityReservationGroupName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public CapacityReservationGroup refresh(Context context) { + CapacityReservationGroupInstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservationGroups() + .getByResourceGroupWithResponse(resourceGroupName, capacityReservationGroupName, localExpand, context) + .getValue(); + return this; + } + + public CapacityReservationGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CapacityReservationGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CapacityReservationGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CapacityReservationGroupImpl withZones(List zones) { + this.innerModel().withZones(zones); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsClientImpl.java new file mode 100644 index 0000000000000..79c539bc2af84 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsClientImpl.java @@ -0,0 +1,1493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CapacityReservationGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupListResult; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapacityReservationGroupsClient. */ +public final class CapacityReservationGroupsClientImpl implements CapacityReservationGroupsClient { + private final ClientLogger logger = new ClientLogger(CapacityReservationGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CapacityReservationGroupsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CapacityReservationGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapacityReservationGroupsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + CapacityReservationGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCapacityReservationGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CapacityReservationGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CapacityReservationGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CapacityReservationGroupUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @QueryParam("$expand") CapacityReservationGroupInstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") ExpandTypesForGetCapacityReservationGroups expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") ExpandTypesForGetCapacityReservationGroups expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, capacityReservationGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationGroupInner createOrUpdate( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, capacityReservationGroupName, parameters).block(); + } + + /** + * The operation to create or update a capacity reservation group. When updating a capacity reservation group, only + * tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Create capacity reservation Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, capacityReservationGroupName, parameters, context) + .block(); + } + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, capacityReservationGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationGroupInner update( + String resourceGroupName, String capacityReservationGroupName, CapacityReservationGroupUpdate parameters) { + return updateAsync(resourceGroupName, capacityReservationGroupName, parameters).block(); + } + + /** + * The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may + * be modified. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param parameters Parameters supplied to the Update capacity reservation Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupUpdate parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, capacityReservationGroupName, parameters, context).block(); + } + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 capacityReservationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 capacityReservationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName) { + return deleteWithResponseAsync(resourceGroupName, capacityReservationGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName) { + deleteAsync(resourceGroupName, capacityReservationGroupName).block(); + } + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String capacityReservationGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, capacityReservationGroupName, context).block(); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, capacityReservationGroupName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String capacityReservationGroupName) { + final CapacityReservationGroupInstanceViewTypes expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, capacityReservationGroupName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationGroupInner getByResourceGroup( + String resourceGroupName, String capacityReservationGroupName) { + final CapacityReservationGroupInstanceViewTypes expand = null; + return getByResourceGroupAsync(resourceGroupName, capacityReservationGroupName, expand).block(); + } + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, capacityReservationGroupName, expand, context) + .block(); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + expand, + 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 capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + expand, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final ExpandTypesForGetCapacityReservationGroups expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final ExpandTypesForGetCapacityReservationGroups expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand)); + } + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, context)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + ExpandTypesForGetCapacityReservationGroups expand) { + 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + expand, + 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 capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + ExpandTypesForGetCapacityReservationGroups expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(ExpandTypesForGetCapacityReservationGroups expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final ExpandTypesForGetCapacityReservationGroups expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(expand), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + ExpandTypesForGetCapacityReservationGroups expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final ExpandTypesForGetCapacityReservationGroups expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + ExpandTypesForGetCapacityReservationGroups expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsImpl.java new file mode 100644 index 0000000000000..66ecd622d1728 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationGroupsImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CapacityReservationGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroup; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroupInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroups; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CapacityReservationGroupsImpl implements CapacityReservationGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupsImpl.class); + + private final CapacityReservationGroupsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CapacityReservationGroupsImpl( + CapacityReservationGroupsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String capacityReservationGroupName) { + this.serviceClient().delete(resourceGroupName, capacityReservationGroupName); + } + + public Response deleteWithResponse( + String resourceGroupName, String capacityReservationGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, capacityReservationGroupName, context); + } + + public CapacityReservationGroup getByResourceGroup(String resourceGroupName, String capacityReservationGroupName) { + CapacityReservationGroupInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, capacityReservationGroupName); + if (inner != null) { + return new CapacityReservationGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, capacityReservationGroupName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CapacityReservationGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CapacityReservationGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, expand, context); + return Utils.mapPage(inner, inner1 -> new CapacityReservationGroupImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CapacityReservationGroupImpl(inner1, this.manager())); + } + + public PagedIterable list( + ExpandTypesForGetCapacityReservationGroups expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new CapacityReservationGroupImpl(inner1, this.manager())); + } + + public CapacityReservationGroup getById(String id) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + CapacityReservationGroupInstanceViewTypes localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, capacityReservationGroupName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, CapacityReservationGroupInstanceViewTypes expand, Context context) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, capacityReservationGroupName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + this.deleteWithResponse(resourceGroupName, capacityReservationGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, capacityReservationGroupName, context); + } + + private CapacityReservationGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public CapacityReservationGroupImpl define(String name) { + return new CapacityReservationGroupImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationImpl.java new file mode 100644 index 0000000000000..afc160b1df1ee --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservation; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceView; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationUpdate; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CapacityReservationImpl + implements CapacityReservation, CapacityReservation.Definition, CapacityReservation.Update { + private CapacityReservationInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String reservationId() { + return this.innerModel().reservationId(); + } + + public List virtualMachinesAssociated() { + List inner = this.innerModel().virtualMachinesAssociated(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime provisioningTime() { + return this.innerModel().provisioningTime(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public CapacityReservationInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CapacityReservationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String capacityReservationGroupName; + + private String capacityReservationName; + + private CapacityReservationUpdate updateParameters; + + public CapacityReservationImpl withExistingCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName) { + this.resourceGroupName = resourceGroupName; + this.capacityReservationGroupName = capacityReservationGroupName; + return this; + } + + public CapacityReservation create() { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .createOrUpdate( + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + this.innerModel(), + Context.NONE); + return this; + } + + public CapacityReservation create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .createOrUpdate( + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + this.innerModel(), + context); + return this; + } + + CapacityReservationImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new CapacityReservationInner(); + this.serviceManager = serviceManager; + this.capacityReservationName = name; + } + + public CapacityReservationImpl update() { + this.updateParameters = new CapacityReservationUpdate(); + return this; + } + + public CapacityReservation apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .update( + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + updateParameters, + Context.NONE); + return this; + } + + public CapacityReservation apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .update( + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + updateParameters, + context); + return this; + } + + CapacityReservationImpl( + CapacityReservationInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.capacityReservationGroupName = Utils.getValueFromIdByName(innerObject.id(), "capacityReservationGroups"); + this.capacityReservationName = Utils.getValueFromIdByName(innerObject.id(), "capacityReservations"); + } + + public CapacityReservation refresh() { + CapacityReservationInstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .getWithResponse( + resourceGroupName, capacityReservationGroupName, capacityReservationName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public CapacityReservation refresh(Context context) { + CapacityReservationInstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCapacityReservations() + .getWithResponse( + resourceGroupName, capacityReservationGroupName, capacityReservationName, localExpand, context) + .getValue(); + return this; + } + + public CapacityReservationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CapacityReservationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CapacityReservationImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public CapacityReservationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CapacityReservationImpl withZones(List zones) { + this.innerModel().withZones(zones); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsClientImpl.java new file mode 100644 index 0000000000000..70478aa901530 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsClientImpl.java @@ -0,0 +1,1701 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.CapacityReservationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationListResult; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationUpdate; +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 CapacityReservationsClient. */ +public final class CapacityReservationsClientImpl implements CapacityReservationsClient { + private final ClientLogger logger = new ClientLogger(CapacityReservationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CapacityReservationsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CapacityReservationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapacityReservationsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(CapacityReservationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCapacityReservations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CapacityReservationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + + "/{capacityReservationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @PathParam("capacityReservationName") String capacityReservationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CapacityReservationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + + "/{capacityReservationName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @PathParam("capacityReservationName") String capacityReservationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CapacityReservationUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + + "/{capacityReservationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @PathParam("capacityReservationName") String capacityReservationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + + "/{capacityReservationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @PathParam("capacityReservationName") String capacityReservationName, + @QueryParam("$expand") CapacityReservationInstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByCapacityReservationGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("capacityReservationGroupName") String capacityReservationGroupName, + @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(ApiErrorException.class) + Mono> listByCapacityReservationGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CapacityReservationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CapacityReservationInner.class, + CapacityReservationInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CapacityReservationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CapacityReservationInner.class, + CapacityReservationInner.class, + context); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CapacityReservationInner> beginCreateOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .getSyncPoller(); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CapacityReservationInner> beginCreateOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationInner createOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters) { + return createOrUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .block(); + } + + /** + * The operation to create or update a capacity reservation. Please note some properties can be set only during + * capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Create capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationInner createOrUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .block(); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CapacityReservationInner> beginUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CapacityReservationInner.class, + CapacityReservationInner.class, + this.client.getContext()); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CapacityReservationInner> beginUpdateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CapacityReservationInner.class, + CapacityReservationInner.class, + context); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CapacityReservationInner> beginUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters) { + return beginUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .getSyncPoller(); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CapacityReservationInner> beginUpdate( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .getSyncPoller(); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters) { + return beginUpdateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationInner update( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters) { + return updateAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters) + .block(); + } + + /** + * The operation to update a capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param parameters Parameters supplied to the Update capacity reservation operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationInner update( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationUpdate parameters, + Context context) { + return updateAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, context) + .block(); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 capacityReservationGroupName, String capacityReservationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 capacityReservationGroupName, + String capacityReservationName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + return beginDeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName) + .getSyncPoller(); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + Context context) { + return beginDeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, context) + .getSyncPoller(); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName, String capacityReservationName) { + return beginDeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName, + String capacityReservationName, + Context context) { + return beginDeleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName, String capacityReservationName) { + deleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName).block(); + } + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 capacityReservationGroupName, + String capacityReservationName, + Context context) { + deleteAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, context).block(); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName is required and cannot be null.")); + } + if (capacityReservationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter capacityReservationName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + capacityReservationName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand) { + return getWithResponseAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + final CapacityReservationInstanceViewTypes expand = null; + return getWithResponseAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapacityReservationInner get( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + final CapacityReservationInstanceViewTypes expand = null; + return getAsync(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand).block(); + } + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand, + Context context) { + return getWithResponseAsync( + resourceGroupName, capacityReservationGroupName, capacityReservationName, expand, context) + .block(); + } + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCapacityReservationGroupSinglePageAsync( + String resourceGroupName, String capacityReservationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCapacityReservationGroup( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + 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 capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCapacityReservationGroupSinglePageAsync( + String resourceGroupName, String capacityReservationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (capacityReservationGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter capacityReservationGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCapacityReservationGroup( + this.client.getEndpoint(), + resourceGroupName, + capacityReservationGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCapacityReservationGroupAsync( + String resourceGroupName, String capacityReservationGroupName) { + return new PagedFlux<>( + () -> listByCapacityReservationGroupSinglePageAsync(resourceGroupName, capacityReservationGroupName), + nextLink -> listByCapacityReservationGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCapacityReservationGroupAsync( + String resourceGroupName, String capacityReservationGroupName, Context context) { + return new PagedFlux<>( + () -> + listByCapacityReservationGroupSinglePageAsync(resourceGroupName, capacityReservationGroupName, context), + nextLink -> listByCapacityReservationGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName) { + return new PagedIterable<>( + listByCapacityReservationGroupAsync(resourceGroupName, capacityReservationGroupName)); + } + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName, Context context) { + return new PagedIterable<>( + listByCapacityReservationGroupAsync(resourceGroupName, capacityReservationGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCapacityReservationGroupNextSinglePageAsync( + 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.listByCapacityReservationGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCapacityReservationGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCapacityReservationGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsImpl.java new file mode 100644 index 0000000000000..f38ce58ff7445 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CapacityReservationsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CapacityReservationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner; +import com.azure.resourcemanager.compute.generated.models.CapacityReservation; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationInstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CapacityReservationsImpl implements CapacityReservations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationsImpl.class); + + private final CapacityReservationsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CapacityReservationsImpl( + CapacityReservationsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + this.serviceClient().delete(resourceGroupName, capacityReservationGroupName, capacityReservationName); + } + + public void delete( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + Context context) { + this.serviceClient().delete(resourceGroupName, capacityReservationGroupName, capacityReservationName, context); + } + + public CapacityReservation get( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName) { + CapacityReservationInner inner = + this.serviceClient().get(resourceGroupName, capacityReservationGroupName, capacityReservationName); + if (inner != null) { + return new CapacityReservationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, capacityReservationGroupName, capacityReservationName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CapacityReservationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName) { + PagedIterable inner = + this.serviceClient().listByCapacityReservationGroup(resourceGroupName, capacityReservationGroupName); + return Utils.mapPage(inner, inner1 -> new CapacityReservationImpl(inner1, this.manager())); + } + + public PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByCapacityReservationGroup(resourceGroupName, capacityReservationGroupName, context); + return Utils.mapPage(inner, inner1 -> new CapacityReservationImpl(inner1, this.manager())); + } + + public CapacityReservation getById(String id) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + String capacityReservationName = Utils.getValueFromIdByName(id, "capacityReservations"); + if (capacityReservationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservations'.", + id))); + } + CapacityReservationInstanceViewTypes localExpand = null; + return this + .getWithResponse( + resourceGroupName, capacityReservationGroupName, capacityReservationName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, CapacityReservationInstanceViewTypes expand, Context context) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + String capacityReservationName = Utils.getValueFromIdByName(id, "capacityReservations"); + if (capacityReservationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservations'.", + id))); + } + return this + .getWithResponse(resourceGroupName, capacityReservationGroupName, capacityReservationName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + String capacityReservationName = Utils.getValueFromIdByName(id, "capacityReservations"); + if (capacityReservationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservations'.", + id))); + } + this.delete(resourceGroupName, capacityReservationGroupName, capacityReservationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 capacityReservationGroupName = Utils.getValueFromIdByName(id, "capacityReservationGroups"); + if (capacityReservationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservationGroups'.", + id))); + } + String capacityReservationName = Utils.getValueFromIdByName(id, "capacityReservations"); + if (capacityReservationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'capacityReservations'.", + id))); + } + this.delete(resourceGroupName, capacityReservationGroupName, capacityReservationName, context); + } + + private CapacityReservationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public CapacityReservationImpl define(String name) { + return new CapacityReservationImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceImpl.java new file mode 100644 index 0000000000000..78712f3d75ce2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner; +import com.azure.resourcemanager.compute.generated.models.CloudService; +import com.azure.resourcemanager.compute.generated.models.CloudServiceProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceUpdate; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Collections; +import java.util.Map; + +public final class CloudServiceImpl implements CloudService, CloudService.Definition, CloudService.Update { + private CloudServiceInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 CloudServiceProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CloudServiceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudServiceName; + + private CloudServiceUpdate updateParameters; + + public CloudServiceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CloudService create() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .createOrUpdate(resourceGroupName, cloudServiceName, this.innerModel(), Context.NONE); + return this; + } + + public CloudService create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .createOrUpdate(resourceGroupName, cloudServiceName, this.innerModel(), context); + return this; + } + + CloudServiceImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new CloudServiceInner(); + this.serviceManager = serviceManager; + this.cloudServiceName = name; + } + + public CloudServiceImpl update() { + this.updateParameters = new CloudServiceUpdate(); + return this; + } + + public CloudService apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .update(resourceGroupName, cloudServiceName, updateParameters, Context.NONE); + return this; + } + + public CloudService apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .update(resourceGroupName, cloudServiceName, updateParameters, context); + return this; + } + + CloudServiceImpl( + CloudServiceInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudServiceName = Utils.getValueFromIdByName(innerObject.id(), "cloudServices"); + } + + public CloudService refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .getByResourceGroupWithResponse(resourceGroupName, cloudServiceName, Context.NONE) + .getValue(); + return this; + } + + public CloudService refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCloudServices() + .getByResourceGroupWithResponse(resourceGroupName, cloudServiceName, context) + .getValue(); + return this; + } + + public void start() { + serviceManager.cloudServices().start(resourceGroupName, cloudServiceName); + } + + public void start(Context context) { + serviceManager.cloudServices().start(resourceGroupName, cloudServiceName, context); + } + + public void powerOff() { + serviceManager.cloudServices().powerOff(resourceGroupName, cloudServiceName); + } + + public void powerOff(Context context) { + serviceManager.cloudServices().powerOff(resourceGroupName, cloudServiceName, context); + } + + public void restart(RoleInstances parameters) { + serviceManager.cloudServices().restart(resourceGroupName, cloudServiceName, parameters); + } + + public void restart() { + serviceManager.cloudServices().restart(resourceGroupName, cloudServiceName); + } + + public void restart(RoleInstances parameters, Context context) { + serviceManager.cloudServices().restart(resourceGroupName, cloudServiceName, parameters, context); + } + + public void reimage(RoleInstances parameters) { + serviceManager.cloudServices().reimage(resourceGroupName, cloudServiceName, parameters); + } + + public void reimage() { + serviceManager.cloudServices().reimage(resourceGroupName, cloudServiceName); + } + + public void reimage(RoleInstances parameters, Context context) { + serviceManager.cloudServices().reimage(resourceGroupName, cloudServiceName, parameters, context); + } + + public void rebuild(RoleInstances parameters) { + serviceManager.cloudServices().rebuild(resourceGroupName, cloudServiceName, parameters); + } + + public void rebuild() { + serviceManager.cloudServices().rebuild(resourceGroupName, cloudServiceName); + } + + public void rebuild(RoleInstances parameters, Context context) { + serviceManager.cloudServices().rebuild(resourceGroupName, cloudServiceName, parameters, context); + } + + public void deleteInstances(RoleInstances parameters) { + serviceManager.cloudServices().deleteInstances(resourceGroupName, cloudServiceName, parameters); + } + + public void deleteInstances() { + serviceManager.cloudServices().deleteInstances(resourceGroupName, cloudServiceName); + } + + public void deleteInstances(RoleInstances parameters, Context context) { + serviceManager.cloudServices().deleteInstances(resourceGroupName, cloudServiceName, parameters, context); + } + + public CloudServiceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudServiceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudServiceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public CloudServiceImpl withProperties(CloudServiceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceInstanceViewImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceInstanceViewImpl.java new file mode 100644 index 0000000000000..c4ad3630d182a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceInstanceViewImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceInstanceView; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatusesSummary; +import com.azure.resourcemanager.compute.generated.models.ResourceInstanceViewStatus; +import java.util.Collections; +import java.util.List; + +public final class CloudServiceInstanceViewImpl implements CloudServiceInstanceView { + private CloudServiceInstanceViewInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + CloudServiceInstanceViewImpl( + CloudServiceInstanceViewInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public InstanceViewStatusesSummary roleInstance() { + return this.innerModel().roleInstance(); + } + + public String sdkVersion() { + return this.innerModel().sdkVersion(); + } + + public List privateIds() { + List inner = this.innerModel().privateIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CloudServiceInstanceViewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsClientImpl.java new file mode 100644 index 0000000000000..51410af200e3c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsClientImpl.java @@ -0,0 +1,944 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceOperatingSystemsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner; +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.OSFamilyListResult; +import com.azure.resourcemanager.compute.generated.models.OSVersionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServiceOperatingSystemsClient. */ +public final class CloudServiceOperatingSystemsClientImpl implements CloudServiceOperatingSystemsClient { + private final ClientLogger logger = new ClientLogger(CloudServiceOperatingSystemsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CloudServiceOperatingSystemsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CloudServiceOperatingSystemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudServiceOperatingSystemsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + CloudServiceOperatingSystemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCloudServiceOperatingSystems to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CloudServiceOperatingSystemsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions" + + "/{osVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getOSVersion( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("osVersionName") String osVersionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listOSVersions( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies" + + "/{osFamilyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getOSFamily( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("osFamilyName") String osFamilyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listOSFamilies( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listOSVersionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listOSFamiliesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSVersionWithResponseAsync(String location, String osVersionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (osVersionName == null) { + return Mono.error(new IllegalArgumentException("Parameter osVersionName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOSVersion( + this.client.getEndpoint(), + location, + osVersionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSVersionWithResponseAsync( + String location, String osVersionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (osVersionName == null) { + return Mono.error(new IllegalArgumentException("Parameter osVersionName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOSVersion( + this.client.getEndpoint(), + location, + osVersionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOSVersionAsync(String location, String osVersionName) { + return getOSVersionWithResponseAsync(location, osVersionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OSVersionInner getOSVersion(String location, String osVersionName) { + return getOSVersionAsync(location, osVersionName).block(); + } + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOSVersionWithResponse(String location, String osVersionName, Context context) { + return getOSVersionWithResponseAsync(location, osVersionName, context).block(); + } + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSVersionsSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listOSVersions( + this.client.getEndpoint(), + location, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSVersionsSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOSVersions( + this.client.getEndpoint(), location, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOSVersionsAsync(String location) { + return new PagedFlux<>( + () -> listOSVersionsSinglePageAsync(location), nextLink -> listOSVersionsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOSVersionsAsync(String location, Context context) { + return new PagedFlux<>( + () -> listOSVersionsSinglePageAsync(location, context), + nextLink -> listOSVersionsNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOSVersions(String location) { + return new PagedIterable<>(listOSVersionsAsync(location)); + } + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOSVersions(String location, Context context) { + return new PagedIterable<>(listOSVersionsAsync(location, context)); + } + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSFamilyWithResponseAsync(String location, String osFamilyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (osFamilyName == null) { + return Mono.error(new IllegalArgumentException("Parameter osFamilyName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOSFamily( + this.client.getEndpoint(), + location, + osFamilyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSFamilyWithResponseAsync( + String location, String osFamilyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (osFamilyName == null) { + return Mono.error(new IllegalArgumentException("Parameter osFamilyName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOSFamily( + this.client.getEndpoint(), + location, + osFamilyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOSFamilyAsync(String location, String osFamilyName) { + return getOSFamilyWithResponseAsync(location, osFamilyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OSFamilyInner getOSFamily(String location, String osFamilyName) { + return getOSFamilyAsync(location, osFamilyName).block(); + } + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOSFamilyWithResponse(String location, String osFamilyName, Context context) { + return getOSFamilyWithResponseAsync(location, osFamilyName, context).block(); + } + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSFamiliesSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listOSFamilies( + this.client.getEndpoint(), + location, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSFamiliesSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOSFamilies( + this.client.getEndpoint(), location, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOSFamiliesAsync(String location) { + return new PagedFlux<>( + () -> listOSFamiliesSinglePageAsync(location), nextLink -> listOSFamiliesNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOSFamiliesAsync(String location, Context context) { + return new PagedFlux<>( + () -> listOSFamiliesSinglePageAsync(location, context), + nextLink -> listOSFamiliesNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOSFamilies(String location) { + return new PagedIterable<>(listOSFamiliesAsync(location)); + } + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOSFamilies(String location, Context context) { + return new PagedIterable<>(listOSFamiliesAsync(location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSVersionsNextSinglePageAsync(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.listOSVersionsNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSVersionsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOSVersionsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSFamiliesNextSinglePageAsync(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.listOSFamiliesNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOSFamiliesNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOSFamiliesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsImpl.java new file mode 100644 index 0000000000000..c3f49599aff6f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceOperatingSystemsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CloudServiceOperatingSystemsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner; +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceOperatingSystems; +import com.azure.resourcemanager.compute.generated.models.OSFamily; +import com.azure.resourcemanager.compute.generated.models.OSVersion; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CloudServiceOperatingSystemsImpl implements CloudServiceOperatingSystems { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceOperatingSystemsImpl.class); + + private final CloudServiceOperatingSystemsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CloudServiceOperatingSystemsImpl( + CloudServiceOperatingSystemsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OSVersion getOSVersion(String location, String osVersionName) { + OSVersionInner inner = this.serviceClient().getOSVersion(location, osVersionName); + if (inner != null) { + return new OSVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOSVersionWithResponse(String location, String osVersionName, Context context) { + Response inner = + this.serviceClient().getOSVersionWithResponse(location, osVersionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OSVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listOSVersions(String location) { + PagedIterable inner = this.serviceClient().listOSVersions(location); + return Utils.mapPage(inner, inner1 -> new OSVersionImpl(inner1, this.manager())); + } + + public PagedIterable listOSVersions(String location, Context context) { + PagedIterable inner = this.serviceClient().listOSVersions(location, context); + return Utils.mapPage(inner, inner1 -> new OSVersionImpl(inner1, this.manager())); + } + + public OSFamily getOSFamily(String location, String osFamilyName) { + OSFamilyInner inner = this.serviceClient().getOSFamily(location, osFamilyName); + if (inner != null) { + return new OSFamilyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOSFamilyWithResponse(String location, String osFamilyName, Context context) { + Response inner = this.serviceClient().getOSFamilyWithResponse(location, osFamilyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OSFamilyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listOSFamilies(String location) { + PagedIterable inner = this.serviceClient().listOSFamilies(location); + return Utils.mapPage(inner, inner1 -> new OSFamilyImpl(inner1, this.manager())); + } + + public PagedIterable listOSFamilies(String location, Context context) { + PagedIterable inner = this.serviceClient().listOSFamilies(location, context); + return Utils.mapPage(inner, inner1 -> new OSFamilyImpl(inner1, this.manager())); + } + + private CloudServiceOperatingSystemsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleImpl.java new file mode 100644 index 0000000000000..cd6057c90628f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRole; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleSku; + +public final class CloudServiceRoleImpl implements CloudServiceRole { + private CloudServiceRoleInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + CloudServiceRoleImpl( + CloudServiceRoleInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 String location() { + return this.innerModel().location(); + } + + public CloudServiceRoleSku sku() { + return this.innerModel().sku(); + } + + public CloudServiceRoleProperties properties() { + return this.innerModel().properties(); + } + + public CloudServiceRoleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesClientImpl.java new file mode 100644 index 0000000000000..ac27aa17b7821 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesClientImpl.java @@ -0,0 +1,2141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +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.Post; +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.http.rest.StreamResponse; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceRoleInstancesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceListResult; +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.ByteBuffer; +import java.util.Enumeration; +import java.util.Iterator; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServiceRoleInstancesClient. */ +public final class CloudServiceRoleInstancesClientImpl implements CloudServiceRoleInstancesClient { + private final ClientLogger logger = new ClientLogger(CloudServiceRoleInstancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CloudServiceRoleInstancesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CloudServiceRoleInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudServiceRoleInstancesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + CloudServiceRoleInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCloudServiceRoleInstances to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CloudServiceRoleInstancesService { + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") InstanceViewTypes expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getInstanceView( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") InstanceViewTypes expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimage( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> rebuild( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono getRemoteDesktopFile( + @HostParam("$host") String endpoint, + @PathParam("roleInstanceName") String roleInstanceName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + Mono>> mono = + deleteWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginDeleteAsync(roleInstanceName, resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + deleteAsync(roleInstanceName, resourceGroupName, cloudServiceName).block(); + } + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + deleteAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String roleInstanceName, + String resourceGroupName, + String cloudServiceName, + InstanceViewTypes expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + expand, + accept, + context); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, InstanceViewTypes expand) { + return getWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + final InstanceViewTypes expand = null; + return getWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInstanceInner get(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + final InstanceViewTypes expand = null; + return getAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand).block(); + } + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String roleInstanceName, + String resourceGroupName, + String cloudServiceName, + InstanceViewTypes expand, + Context context) { + return getWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand, context).block(); + } + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getInstanceView( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInstanceView( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInstanceViewAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return getInstanceViewWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleInstanceViewInner getInstanceView( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return getInstanceViewAsync(roleInstanceName, resourceGroupName, cloudServiceName).block(); + } + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInstanceViewWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return getInstanceViewWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + expand, + 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 the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + expand, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cloudServiceName, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String cloudServiceName) { + final InstanceViewTypes expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cloudServiceName, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cloudServiceName, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cloudServiceName) { + final InstanceViewTypes expand = null; + return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName, expand)); + } + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName, expand, context)); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + Mono>> mono = + restartWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginRestartAsync(roleInstanceName, resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName) { + restartAsync(roleInstanceName, resourceGroupName, cloudServiceName).block(); + } + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + restartAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimage( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimage( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + Mono>> mono = + reimageWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginReimageAsync(roleInstanceName, resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + reimageAsync(roleInstanceName, resourceGroupName, cloudServiceName).block(); + } + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + reimageAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> rebuildWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .rebuild( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> rebuildWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .rebuild( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRebuildAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + Mono>> mono = + rebuildWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRebuildAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + rebuildWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRebuild( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRebuild( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuildAsync(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return beginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuildAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return beginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + rebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).block(); + } + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + rebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRemoteDesktopFileWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/x-rdp"; + return FluxUtil + .withContext( + context -> + service + .getRemoteDesktopFile( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRemoteDesktopFileWithResponseAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleInstanceName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/x-rdp"; + context = this.client.mergeContext(context); + return service + .getRemoteDesktopFile( + this.client.getEndpoint(), + roleInstanceName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Flux getRemoteDesktopFileAsync( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return getRemoteDesktopFileWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .flatMapMany(StreamResponse::getValue); + } + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream getRemoteDesktopFile( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + Iterator iterator = + getRemoteDesktopFileAsync(roleInstanceName, resourceGroupName, cloudServiceName) + .map(ByteBufferBackedInputStream::new) + .toStream() + .iterator(); + Enumeration enumeration = + new Enumeration() { + @Override + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + @Override + public InputStream nextElement() { + return iterator.next(); + } + }; + return new SequenceInputStream(enumeration); + } + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StreamResponse getRemoteDesktopFileWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return getRemoteDesktopFileWithResponseAsync(roleInstanceName, resourceGroupName, cloudServiceName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesImpl.java new file mode 100644 index 0000000000000..e1c95ee985614 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRoleInstancesImpl.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.http.rest.StreamResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceRoleInstancesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleInstances; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RoleInstance; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceView; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.InputStream; + +public final class CloudServiceRoleInstancesImpl implements CloudServiceRoleInstances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleInstancesImpl.class); + + private final CloudServiceRoleInstancesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CloudServiceRoleInstancesImpl( + CloudServiceRoleInstancesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + this.serviceClient().delete(roleInstanceName, resourceGroupName, cloudServiceName); + } + + public void delete(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().delete(roleInstanceName, resourceGroupName, cloudServiceName, context); + } + + public RoleInstance get(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + RoleInstanceInner inner = this.serviceClient().get(roleInstanceName, resourceGroupName, cloudServiceName); + if (inner != null) { + return new RoleInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String roleInstanceName, + String resourceGroupName, + String cloudServiceName, + InstanceViewTypes expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(roleInstanceName, resourceGroupName, cloudServiceName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleInstanceView getInstanceView( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + RoleInstanceViewInner inner = + this.serviceClient().getInstanceView(roleInstanceName, resourceGroupName, cloudServiceName); + if (inner != null) { + return new RoleInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getInstanceViewWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + Response inner = + this + .serviceClient() + .getInstanceViewWithResponse(roleInstanceName, resourceGroupName, cloudServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleInstanceViewImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String cloudServiceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, cloudServiceName); + return Utils.mapPage(inner, inner1 -> new RoleInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, cloudServiceName, expand, context); + return Utils.mapPage(inner, inner1 -> new RoleInstanceImpl(inner1, this.manager())); + } + + public void restart(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + this.serviceClient().restart(roleInstanceName, resourceGroupName, cloudServiceName); + } + + public void restart(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().restart(roleInstanceName, resourceGroupName, cloudServiceName, context); + } + + public void reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + this.serviceClient().reimage(roleInstanceName, resourceGroupName, cloudServiceName); + } + + public void reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().reimage(roleInstanceName, resourceGroupName, cloudServiceName, context); + } + + public void rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName) { + this.serviceClient().rebuild(roleInstanceName, resourceGroupName, cloudServiceName); + } + + public void rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().rebuild(roleInstanceName, resourceGroupName, cloudServiceName, context); + } + + public InputStream getRemoteDesktopFile( + String roleInstanceName, String resourceGroupName, String cloudServiceName) { + return this.serviceClient().getRemoteDesktopFile(roleInstanceName, resourceGroupName, cloudServiceName); + } + + public StreamResponse getRemoteDesktopFileWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context) { + return this + .serviceClient() + .getRemoteDesktopFileWithResponse(roleInstanceName, resourceGroupName, cloudServiceName, context); + } + + private CloudServiceRoleInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesClientImpl.java new file mode 100644 index 0000000000000..d960f0fd6152d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesClientImpl.java @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceRolesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CloudServiceRolesClient. */ +public final class CloudServiceRolesClientImpl implements CloudServiceRolesClient { + private final ClientLogger logger = new ClientLogger(CloudServiceRolesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CloudServiceRolesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CloudServiceRolesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudServiceRolesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(CloudServiceRolesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCloudServiceRoles to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CloudServiceRolesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roles/{roleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("roleName") String roleName, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/roles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String roleName, String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + roleName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String roleName, String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleName == null) { + return Mono.error(new IllegalArgumentException("Parameter roleName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + roleName, + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String roleName, String resourceGroupName, String cloudServiceName) { + return getWithResponseAsync(roleName, resourceGroupName, cloudServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceRoleInner get(String roleName, String resourceGroupName, String cloudServiceName) { + return getAsync(roleName, resourceGroupName, cloudServiceName).block(); + } + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String roleName, String resourceGroupName, String cloudServiceName, Context context) { + return getWithResponseAsync(roleName, resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String cloudServiceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cloudServiceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String cloudServiceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cloudServiceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cloudServiceName) { + return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName)); + } + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String cloudServiceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, cloudServiceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesImpl.java new file mode 100644 index 0000000000000..5bf84ca6b0c84 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServiceRolesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CloudServiceRolesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRole; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CloudServiceRolesImpl implements CloudServiceRoles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRolesImpl.class); + + private final CloudServiceRolesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CloudServiceRolesImpl( + CloudServiceRolesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CloudServiceRole get(String roleName, String resourceGroupName, String cloudServiceName) { + CloudServiceRoleInner inner = this.serviceClient().get(roleName, resourceGroupName, cloudServiceName); + if (inner != null) { + return new CloudServiceRoleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String roleName, String resourceGroupName, String cloudServiceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(roleName, resourceGroupName, cloudServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudServiceRoleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String cloudServiceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, cloudServiceName); + return Utils.mapPage(inner, inner1 -> new CloudServiceRoleImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String cloudServiceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, cloudServiceName, context); + return Utils.mapPage(inner, inner1 -> new CloudServiceRoleImpl(inner1, this.manager())); + } + + private CloudServiceRolesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesClientImpl.java new file mode 100644 index 0000000000000..6787d0206f31b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesClientImpl.java @@ -0,0 +1,3556 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.CloudServicesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.CloudServiceListResult; +import com.azure.resourcemanager.compute.generated.models.CloudServiceUpdate; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +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 CloudServicesClient. */ +public final class CloudServicesClientImpl implements CloudServicesClient { + private final ClientLogger logger = new ClientLogger(CloudServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CloudServicesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CloudServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudServicesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(CloudServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCloudServices to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CloudServicesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudServiceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudServiceUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/instanceView") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getInstanceView( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/poweroff") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> powerOff( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleInstances parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/reimage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimage( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleInstances parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/rebuild") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> rebuild( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleInstances parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/delete") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deleteInstances( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleInstances parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CloudServiceInner.class, + CloudServiceInner.class, + this.client.getContext()); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudServiceInner.class, CloudServiceInner.class, context); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudServiceInner> beginCreateOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudServiceInner> beginCreateOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudServiceName) { + final CloudServiceInner parameters = null; + return beginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner createOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters) { + return createOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner createOrUpdate(String resourceGroupName, String cloudServiceName) { + final CloudServiceInner parameters = null; + return createOrUpdateAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Create or update a cloud service. Please note some properties can be set only during cloud service creation. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner createOrUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudServiceInner> beginUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CloudServiceInner.class, + CloudServiceInner.class, + this.client.getContext()); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudServiceInner> beginUpdateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudServiceInner.class, CloudServiceInner.class, context); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudServiceInner> beginUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudServiceInner> beginUpdate( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cloudServiceName) { + final CloudServiceUpdate parameters = null; + return beginUpdateAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner update(String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters) { + return updateAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner update(String resourceGroupName, String cloudServiceName) { + final CloudServiceUpdate parameters = null; + return updateAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Update a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters The cloud service object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner update( + String resourceGroupName, String cloudServiceName, CloudServiceUpdate parameters, Context context) { + return updateAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudServiceName) { + return beginDeleteAsync(resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cloudServiceName) { + return beginDeleteAsync(resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cloudServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cloudServiceName) { + deleteAsync(resourceGroupName, cloudServiceName).block(); + } + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cloudServiceName, Context context) { + deleteAsync(resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudServiceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInner getByResourceGroup(String resourceGroupName, String cloudServiceName) { + return getByResourceGroupAsync(resourceGroupName, cloudServiceName).block(); + } + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudServiceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInstanceViewAsync( + String resourceGroupName, String cloudServiceName) { + return getInstanceViewWithResponseAsync(resourceGroupName, cloudServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudServiceInstanceViewInner getInstanceView(String resourceGroupName, String cloudServiceName) { + return getInstanceViewAsync(resourceGroupName, cloudServiceName).block(); + } + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInstanceViewWithResponse( + String resourceGroupName, String cloudServiceName, Context context) { + return getInstanceViewWithResponseAsync(resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, 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 a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String cloudServiceName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String cloudServiceName) { + return beginStartAsync(resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String cloudServiceName, Context context) { + return beginStartAsync(resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName) { + return beginStartAsync(resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, Context context) { + return beginStartAsync(resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName) { + startAsync(resourceGroupName, cloudServiceName).block(); + } + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, Context context) { + startAsync(resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync(String resourceGroupName, String cloudServiceName) { + Mono>> mono = powerOffWithResponseAsync(resourceGroupName, cloudServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, String cloudServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = powerOffWithResponseAsync(resourceGroupName, cloudServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff(String resourceGroupName, String cloudServiceName) { + return beginPowerOffAsync(resourceGroupName, cloudServiceName).getSyncPoller(); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, String cloudServiceName, Context context) { + return beginPowerOffAsync(resourceGroupName, cloudServiceName, context).getSyncPoller(); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String cloudServiceName) { + return beginPowerOffAsync(resourceGroupName, cloudServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String cloudServiceName, Context context) { + return beginPowerOffAsync(resourceGroupName, cloudServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String cloudServiceName) { + powerOffAsync(resourceGroupName, cloudServiceName).block(); + } + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String cloudServiceName, Context context) { + powerOffAsync(resourceGroupName, cloudServiceName, context).block(); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String cloudServiceName, RoleInstances parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + Mono>> mono = + restartWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginRestartAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginRestartAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginRestartAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + return beginRestartAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginRestartAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters) { + restartAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + restartAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + restartAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginReimageAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginReimageAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginReimageAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + return beginReimageAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginReimageAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + reimageAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + reimageAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + reimageAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> rebuildWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .rebuild( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> rebuildWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .rebuild( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRebuildAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + Mono>> mono = + rebuildWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRebuildAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + rebuildWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRebuild( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginRebuildAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRebuild( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginRebuildAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuildAsync(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginRebuildAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuildAsync(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + return beginRebuildAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuildAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginRebuildAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + rebuildAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + rebuildAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + rebuildAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteInstancesWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteInstances( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteInstancesWithResponseAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteInstances( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteInstancesAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + Mono>> mono = + deleteInstancesWithResponseAsync(resourceGroupName, cloudServiceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteInstancesAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteInstancesWithResponseAsync(resourceGroupName, cloudServiceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginDeleteInstancesAsync(resourceGroupName, cloudServiceName, parameters).getSyncPoller(); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginDeleteInstancesAsync(resourceGroupName, cloudServiceName, parameters, context).getSyncPoller(); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + return beginDeleteInstancesAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + return beginDeleteInstancesAsync(resourceGroupName, cloudServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + return beginDeleteInstancesAsync(resourceGroupName, cloudServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + deleteInstancesAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances(String resourceGroupName, String cloudServiceName) { + final RoleInstances parameters = null; + deleteInstancesAsync(resourceGroupName, cloudServiceName, parameters).block(); + } + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + deleteInstancesAsync(resourceGroupName, cloudServiceName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesImpl.java new file mode 100644 index 0000000000000..8448f7e9ad125 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesImpl.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CloudServicesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.CloudService; +import com.azure.resourcemanager.compute.generated.models.CloudServiceInstanceView; +import com.azure.resourcemanager.compute.generated.models.CloudServices; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CloudServicesImpl implements CloudServices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServicesImpl.class); + + private final CloudServicesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CloudServicesImpl( + CloudServicesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudServiceName) { + this.serviceClient().delete(resourceGroupName, cloudServiceName); + } + + public void delete(String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudServiceName, context); + } + + public CloudService getByResourceGroup(String resourceGroupName, String cloudServiceName) { + CloudServiceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudServiceName); + if (inner != null) { + return new CloudServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudServiceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudServiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CloudServiceInstanceView getInstanceView(String resourceGroupName, String cloudServiceName) { + CloudServiceInstanceViewInner inner = this.serviceClient().getInstanceView(resourceGroupName, cloudServiceName); + if (inner != null) { + return new CloudServiceInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getInstanceViewWithResponse( + String resourceGroupName, String cloudServiceName, Context context) { + Response inner = + this.serviceClient().getInstanceViewWithResponse(resourceGroupName, cloudServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudServiceInstanceViewImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CloudServiceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CloudServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CloudServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CloudServiceImpl(inner1, this.manager())); + } + + public void start(String resourceGroupName, String cloudServiceName) { + this.serviceClient().start(resourceGroupName, cloudServiceName); + } + + public void start(String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().start(resourceGroupName, cloudServiceName, context); + } + + public void powerOff(String resourceGroupName, String cloudServiceName) { + this.serviceClient().powerOff(resourceGroupName, cloudServiceName); + } + + public void powerOff(String resourceGroupName, String cloudServiceName, Context context) { + this.serviceClient().powerOff(resourceGroupName, cloudServiceName, context); + } + + public void restart(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + this.serviceClient().restart(resourceGroupName, cloudServiceName, parameters); + } + + public void restart(String resourceGroupName, String cloudServiceName) { + this.serviceClient().restart(resourceGroupName, cloudServiceName); + } + + public void restart(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + this.serviceClient().restart(resourceGroupName, cloudServiceName, parameters, context); + } + + public void reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + this.serviceClient().reimage(resourceGroupName, cloudServiceName, parameters); + } + + public void reimage(String resourceGroupName, String cloudServiceName) { + this.serviceClient().reimage(resourceGroupName, cloudServiceName); + } + + public void reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + this.serviceClient().reimage(resourceGroupName, cloudServiceName, parameters, context); + } + + public void rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + this.serviceClient().rebuild(resourceGroupName, cloudServiceName, parameters); + } + + public void rebuild(String resourceGroupName, String cloudServiceName) { + this.serviceClient().rebuild(resourceGroupName, cloudServiceName); + } + + public void rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + this.serviceClient().rebuild(resourceGroupName, cloudServiceName, parameters, context); + } + + public void deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters) { + this.serviceClient().deleteInstances(resourceGroupName, cloudServiceName, parameters); + } + + public void deleteInstances(String resourceGroupName, String cloudServiceName) { + this.serviceClient().deleteInstances(resourceGroupName, cloudServiceName); + } + + public void deleteInstances( + String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context) { + this.serviceClient().deleteInstances(resourceGroupName, cloudServiceName, parameters, context); + } + + public CloudService getById(String id) { + String resourceGroupName = Utils.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 cloudServiceName = Utils.getValueFromIdByName(id, "cloudServices"); + if (cloudServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudServiceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 cloudServiceName = Utils.getValueFromIdByName(id, "cloudServices"); + if (cloudServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudServiceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 cloudServiceName = Utils.getValueFromIdByName(id, "cloudServices"); + if (cloudServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudServices'.", id))); + } + this.delete(resourceGroupName, cloudServiceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 cloudServiceName = Utils.getValueFromIdByName(id, "cloudServices"); + if (cloudServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudServices'.", id))); + } + this.delete(resourceGroupName, cloudServiceName, context); + } + + private CloudServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public CloudServiceImpl define(String name) { + return new CloudServiceImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsClientImpl.java new file mode 100644 index 0000000000000..a18d847c61af7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsClientImpl.java @@ -0,0 +1,901 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.polling.PollResult; +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.compute.generated.fluent.CloudServicesUpdateDomainsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.UpdateDomainListResult; +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 CloudServicesUpdateDomainsClient. */ +public final class CloudServicesUpdateDomainsClientImpl implements CloudServicesUpdateDomainsClient { + private final ClientLogger logger = new ClientLogger(CloudServicesUpdateDomainsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CloudServicesUpdateDomainsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CloudServicesUpdateDomainsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudServicesUpdateDomainsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + CloudServicesUpdateDomainsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCloudServicesUpdateDomains to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CloudServicesUpdateDomainsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> walkUpdateDomain( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("updateDomain") int updateDomain, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateDomainInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getUpdateDomain( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("updateDomain") int updateDomain, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/cloudServices/{cloudServiceName}/updateDomains") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listUpdateDomains( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudServiceName") String cloudServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listUpdateDomainsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> walkUpdateDomainWithResponseAsync( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .walkUpdateDomain( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + updateDomain, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> walkUpdateDomainWithResponseAsync( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .walkUpdateDomain( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + updateDomain, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginWalkUpdateDomainAsync( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + Mono>> mono = + walkUpdateDomainWithResponseAsync(resourceGroupName, cloudServiceName, updateDomain, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginWalkUpdateDomainAsync( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + walkUpdateDomainWithResponseAsync(resourceGroupName, cloudServiceName, updateDomain, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginWalkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + return beginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters) + .getSyncPoller(); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginWalkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + return beginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters, context) + .getSyncPoller(); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomainAsync( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + return beginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomainAsync(String resourceGroupName, String cloudServiceName, int updateDomain) { + final UpdateDomainInner parameters = null; + return beginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomainAsync( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + return beginWalkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + walkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters).block(); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain) { + final UpdateDomainInner parameters = null; + walkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters).block(); + } + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 walkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + walkUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain, parameters, context).block(); + } + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 update domain of a cloud service along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateDomainWithResponseAsync( + String resourceGroupName, String cloudServiceName, int updateDomain) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getUpdateDomain( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + updateDomain, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 update domain of a cloud service along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUpdateDomainWithResponseAsync( + String resourceGroupName, String cloudServiceName, int updateDomain, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getUpdateDomain( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + updateDomain, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 update domain of a cloud service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getUpdateDomainAsync( + String resourceGroupName, String cloudServiceName, int updateDomain) { + return getUpdateDomainWithResponseAsync(resourceGroupName, cloudServiceName, updateDomain) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 update domain of a cloud service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateDomainInner getUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain) { + return getUpdateDomainAsync(resourceGroupName, cloudServiceName, updateDomain).block(); + } + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 update domain of a cloud service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUpdateDomainWithResponse( + String resourceGroupName, String cloudServiceName, int updateDomain, Context context) { + return getUpdateDomainWithResponseAsync(resourceGroupName, cloudServiceName, updateDomain, context).block(); + } + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdateDomainsSinglePageAsync( + String resourceGroupName, String cloudServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUpdateDomains( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdateDomainsSinglePageAsync( + String resourceGroupName, String cloudServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudServiceName 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 apiVersion = "2021-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUpdateDomains( + this.client.getEndpoint(), + resourceGroupName, + cloudServiceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUpdateDomainsAsync(String resourceGroupName, String cloudServiceName) { + return new PagedFlux<>( + () -> listUpdateDomainsSinglePageAsync(resourceGroupName, cloudServiceName), + nextLink -> listUpdateDomainsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUpdateDomainsAsync( + String resourceGroupName, String cloudServiceName, Context context) { + return new PagedFlux<>( + () -> listUpdateDomainsSinglePageAsync(resourceGroupName, cloudServiceName, context), + nextLink -> listUpdateDomainsNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdateDomains(String resourceGroupName, String cloudServiceName) { + return new PagedIterable<>(listUpdateDomainsAsync(resourceGroupName, cloudServiceName)); + } + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdateDomains( + String resourceGroupName, String cloudServiceName, Context context) { + return new PagedIterable<>(listUpdateDomainsAsync(resourceGroupName, cloudServiceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdateDomainsNextSinglePageAsync(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.listUpdateDomainsNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdateDomainsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUpdateDomainsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsImpl.java new file mode 100644 index 0000000000000..9ad35a2cde64c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CloudServicesUpdateDomainsImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CloudServicesUpdateDomainsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner; +import com.azure.resourcemanager.compute.generated.models.CloudServicesUpdateDomains; +import com.azure.resourcemanager.compute.generated.models.UpdateDomain; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CloudServicesUpdateDomainsImpl implements CloudServicesUpdateDomains { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServicesUpdateDomainsImpl.class); + + private final CloudServicesUpdateDomainsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CloudServicesUpdateDomainsImpl( + CloudServicesUpdateDomainsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void walkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters) { + this.serviceClient().walkUpdateDomain(resourceGroupName, cloudServiceName, updateDomain, parameters); + } + + public void walkUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain) { + this.serviceClient().walkUpdateDomain(resourceGroupName, cloudServiceName, updateDomain); + } + + public void walkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context) { + this.serviceClient().walkUpdateDomain(resourceGroupName, cloudServiceName, updateDomain, parameters, context); + } + + public UpdateDomain getUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain) { + UpdateDomainInner inner = + this.serviceClient().getUpdateDomain(resourceGroupName, cloudServiceName, updateDomain); + if (inner != null) { + return new UpdateDomainImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getUpdateDomainWithResponse( + String resourceGroupName, String cloudServiceName, int updateDomain, Context context) { + Response inner = + this + .serviceClient() + .getUpdateDomainWithResponse(resourceGroupName, cloudServiceName, updateDomain, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UpdateDomainImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listUpdateDomains(String resourceGroupName, String cloudServiceName) { + PagedIterable inner = + this.serviceClient().listUpdateDomains(resourceGroupName, cloudServiceName); + return Utils.mapPage(inner, inner1 -> new UpdateDomainImpl(inner1, this.manager())); + } + + public PagedIterable listUpdateDomains( + String resourceGroupName, String cloudServiceName, Context context) { + PagedIterable inner = + this.serviceClient().listUpdateDomains(resourceGroupName, cloudServiceName, context); + return Utils.mapPage(inner, inner1 -> new UpdateDomainImpl(inner1, this.manager())); + } + + private CloudServicesUpdateDomainsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesClientImpl.java new file mode 100644 index 0000000000000..45c822cb204e1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CommunityGalleriesClient. */ +public final class CommunityGalleriesClientImpl implements CommunityGalleriesClient { + private final ClientLogger logger = new ClientLogger(CommunityGalleriesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CommunityGalleriesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CommunityGalleriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityGalleriesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(CommunityGalleriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCommunityGalleries to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CommunityGalleriesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries" + + "/{publicGalleryName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("publicGalleryName") String publicGalleryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String publicGalleryName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + publicGalleryName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publicGalleryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + publicGalleryName, + apiVersion, + accept, + context); + } + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String publicGalleryName) { + return getWithResponseAsync(location, publicGalleryName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityGalleryInner get(String location, String publicGalleryName) { + return getAsync(location, publicGalleryName).block(); + } + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String publicGalleryName, Context context) { + return getWithResponseAsync(location, publicGalleryName, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesImpl.java new file mode 100644 index 0000000000000..eceee597fc4f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleriesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CommunityGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleries; +import com.azure.resourcemanager.compute.generated.models.CommunityGallery; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CommunityGalleriesImpl implements CommunityGalleries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleriesImpl.class); + + private final CommunityGalleriesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CommunityGalleriesImpl( + CommunityGalleriesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CommunityGallery get(String location, String publicGalleryName) { + CommunityGalleryInner inner = this.serviceClient().get(location, publicGalleryName); + if (inner != null) { + return new CommunityGalleryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String publicGalleryName, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, publicGalleryName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunityGalleryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CommunityGalleriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageImpl.java new file mode 100644 index 0000000000000..5b8c79df8c7fa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImage; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class CommunityGalleryImageImpl implements CommunityGalleryImage { + private CommunityGalleryImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + CommunityGalleryImageImpl( + CommunityGalleryImageInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String type() { + return this.innerModel().type(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public OperatingSystemStateTypes osState() { + return this.innerModel().osState(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public GalleryImageIdentifier identifier() { + return this.innerModel().identifier(); + } + + public RecommendedMachineConfiguration recommended() { + return this.innerModel().recommended(); + } + + public Disallowed disallowed() { + return this.innerModel().disallowed(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public List features() { + List inner = this.innerModel().features(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ImagePurchasePlan purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public CommunityGalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionImpl.java new file mode 100644 index 0000000000000..2f85dd76f9ba6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImageVersion; +import java.time.OffsetDateTime; + +public final class CommunityGalleryImageVersionImpl implements CommunityGalleryImageVersion { + private CommunityGalleryImageVersionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + CommunityGalleryImageVersionImpl( + CommunityGalleryImageVersionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String type() { + return this.innerModel().type(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public OffsetDateTime publishedDate() { + return this.innerModel().publishedDate(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public CommunityGalleryImageVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsClientImpl.java new file mode 100644 index 0000000000000..547a38fe5a30a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsClientImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CommunityGalleryImageVersionsClient. */ +public final class CommunityGalleryImageVersionsClientImpl implements CommunityGalleryImageVersionsClient { + private final ClientLogger logger = new ClientLogger(CommunityGalleryImageVersionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CommunityGalleryImageVersionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CommunityGalleryImageVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityGalleryImageVersionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + CommunityGalleryImageVersionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCommunityGalleryImageVersions to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CommunityGalleryImageVersionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries" + + "/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("publicGalleryName") String publicGalleryName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + publicGalleryName, + galleryImageName, + galleryImageVersionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, + String publicGalleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + publicGalleryName, + galleryImageName, + galleryImageVersionName, + accept, + context); + } + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName) { + return getWithResponseAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityGalleryImageVersionInner get( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName) { + return getAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName).block(); + } + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, + String publicGalleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + return getWithResponseAsync(location, publicGalleryName, galleryImageName, galleryImageVersionName, context) + .block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsImpl.java new file mode 100644 index 0000000000000..75e0d0b472c3b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImageVersionsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CommunityGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImageVersions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CommunityGalleryImageVersionsImpl implements CommunityGalleryImageVersions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImageVersionsImpl.class); + + private final CommunityGalleryImageVersionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CommunityGalleryImageVersionsImpl( + CommunityGalleryImageVersionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CommunityGalleryImageVersion get( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName) { + CommunityGalleryImageVersionInner inner = + this.serviceClient().get(location, publicGalleryName, galleryImageName, galleryImageVersionName); + if (inner != null) { + return new CommunityGalleryImageVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, + String publicGalleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(location, publicGalleryName, galleryImageName, galleryImageVersionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunityGalleryImageVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CommunityGalleryImageVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesClientImpl.java new file mode 100644 index 0000000000000..95b5e57642353 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CommunityGalleryImagesClient. */ +public final class CommunityGalleryImagesClientImpl implements CommunityGalleryImagesClient { + private final ClientLogger logger = new ClientLogger(CommunityGalleryImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CommunityGalleryImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of CommunityGalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityGalleryImagesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(CommunityGalleryImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientCommunityGalleryImages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface CommunityGalleryImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries" + + "/{publicGalleryName}/images/{galleryImageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("publicGalleryName") String publicGalleryName, + @PathParam("galleryImageName") String galleryImageName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publicGalleryName, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + publicGalleryName, + galleryImageName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publicGalleryName, String galleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publicGalleryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter publicGalleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + publicGalleryName, + galleryImageName, + accept, + context); + } + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String publicGalleryName, String galleryImageName) { + return getWithResponseAsync(location, publicGalleryName, galleryImageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityGalleryImageInner get(String location, String publicGalleryName, String galleryImageName) { + return getAsync(location, publicGalleryName, galleryImageName).block(); + } + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, String publicGalleryName, String galleryImageName, Context context) { + return getWithResponseAsync(location, publicGalleryName, galleryImageName, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesImpl.java new file mode 100644 index 0000000000000..f3c02bee908fb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImagesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.CommunityGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImage; +import com.azure.resourcemanager.compute.generated.models.CommunityGalleryImages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CommunityGalleryImagesImpl implements CommunityGalleryImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunityGalleryImagesImpl.class); + + private final CommunityGalleryImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public CommunityGalleryImagesImpl( + CommunityGalleryImagesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CommunityGalleryImage get(String location, String publicGalleryName, String galleryImageName) { + CommunityGalleryImageInner inner = this.serviceClient().get(location, publicGalleryName, galleryImageName); + if (inner != null) { + return new CommunityGalleryImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, String publicGalleryName, String galleryImageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, publicGalleryName, galleryImageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunityGalleryImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CommunityGalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImpl.java new file mode 100644 index 0000000000000..f8089acb8e2a8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/CommunityGalleryImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryInner; +import com.azure.resourcemanager.compute.generated.models.CommunityGallery; + +public final class CommunityGalleryImpl implements CommunityGallery { + private CommunityGalleryInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + CommunityGalleryImpl( + CommunityGalleryInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String type() { + return this.innerModel().type(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public CommunityGalleryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientBuilder.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientBuilder.java new file mode 100644 index 0000000000000..5b2ac850e1403 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientBuilder.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.CookiePolicy; +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 ComputeManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ComputeManagementClientImpl.class}) +public final class ComputeManagementClientBuilder { + /* + * Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ComputeManagementClientBuilder. + */ + public ComputeManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ComputeManagementClientImpl with the provided parameters. + * + * @return an instance of ComputeManagementClientImpl. + */ + public ComputeManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ComputeManagementClientImpl client = + new ComputeManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientImpl.java new file mode 100644 index 0000000000000..b7795bbf5a938 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeManagementClientImpl.java @@ -0,0 +1,957 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.compute.generated.fluent.CapacityReservationGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.CapacityReservationsClient; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceOperatingSystemsClient; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceRoleInstancesClient; +import com.azure.resourcemanager.compute.generated.fluent.CloudServiceRolesClient; +import com.azure.resourcemanager.compute.generated.fluent.CloudServicesClient; +import com.azure.resourcemanager.compute.generated.fluent.CloudServicesUpdateDomainsClient; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.CommunityGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.ComputeManagementClient; +import com.azure.resourcemanager.compute.generated.fluent.DedicatedHostGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.DedicatedHostsClient; +import com.azure.resourcemanager.compute.generated.fluent.DiskAccessesClient; +import com.azure.resourcemanager.compute.generated.fluent.DiskEncryptionSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.DiskRestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.DisksClient; +import com.azure.resourcemanager.compute.generated.fluent.GalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.GalleryApplicationVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.GalleryApplicationsClient; +import com.azure.resourcemanager.compute.generated.fluent.GalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.GalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.GallerySharingProfilesClient; +import com.azure.resourcemanager.compute.generated.fluent.ImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.LogAnalyticsClient; +import com.azure.resourcemanager.compute.generated.fluent.OperationsClient; +import com.azure.resourcemanager.compute.generated.fluent.ProximityPlacementGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.ResourceSkusClient; +import com.azure.resourcemanager.compute.generated.fluent.RestorePointCollectionsClient; +import com.azure.resourcemanager.compute.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.SnapshotsClient; +import com.azure.resourcemanager.compute.generated.fluent.SshPublicKeysClient; +import com.azure.resourcemanager.compute.generated.fluent.UsagesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineExtensionImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineImagesEdgeZonesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetRollingUpgradesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetVMExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetVMRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetVMsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineSizesClient; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachinesClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ComputeManagementClientImpl type. */ +@ServiceClient(builder = ComputeManagementClientBuilder.class) +public final class ComputeManagementClientImpl implements ComputeManagementClient { + private final ClientLogger logger = new ClientLogger(ComputeManagementClientImpl.class); + + /** + * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AvailabilitySetsClient object to access its operations. */ + private final AvailabilitySetsClient availabilitySets; + + /** + * Gets the AvailabilitySetsClient object to access its operations. + * + * @return the AvailabilitySetsClient object. + */ + public AvailabilitySetsClient getAvailabilitySets() { + return this.availabilitySets; + } + + /** The ProximityPlacementGroupsClient object to access its operations. */ + private final ProximityPlacementGroupsClient proximityPlacementGroups; + + /** + * Gets the ProximityPlacementGroupsClient object to access its operations. + * + * @return the ProximityPlacementGroupsClient object. + */ + public ProximityPlacementGroupsClient getProximityPlacementGroups() { + return this.proximityPlacementGroups; + } + + /** The DedicatedHostGroupsClient object to access its operations. */ + private final DedicatedHostGroupsClient dedicatedHostGroups; + + /** + * Gets the DedicatedHostGroupsClient object to access its operations. + * + * @return the DedicatedHostGroupsClient object. + */ + public DedicatedHostGroupsClient getDedicatedHostGroups() { + return this.dedicatedHostGroups; + } + + /** The DedicatedHostsClient object to access its operations. */ + private final DedicatedHostsClient dedicatedHosts; + + /** + * Gets the DedicatedHostsClient object to access its operations. + * + * @return the DedicatedHostsClient object. + */ + public DedicatedHostsClient getDedicatedHosts() { + return this.dedicatedHosts; + } + + /** The SshPublicKeysClient object to access its operations. */ + private final SshPublicKeysClient sshPublicKeys; + + /** + * Gets the SshPublicKeysClient object to access its operations. + * + * @return the SshPublicKeysClient object. + */ + public SshPublicKeysClient getSshPublicKeys() { + return this.sshPublicKeys; + } + + /** The VirtualMachineExtensionImagesClient object to access its operations. */ + private final VirtualMachineExtensionImagesClient virtualMachineExtensionImages; + + /** + * Gets the VirtualMachineExtensionImagesClient object to access its operations. + * + * @return the VirtualMachineExtensionImagesClient object. + */ + public VirtualMachineExtensionImagesClient getVirtualMachineExtensionImages() { + return this.virtualMachineExtensionImages; + } + + /** The VirtualMachineExtensionsClient object to access its operations. */ + private final VirtualMachineExtensionsClient virtualMachineExtensions; + + /** + * Gets the VirtualMachineExtensionsClient object to access its operations. + * + * @return the VirtualMachineExtensionsClient object. + */ + public VirtualMachineExtensionsClient getVirtualMachineExtensions() { + return this.virtualMachineExtensions; + } + + /** The VirtualMachineImagesClient object to access its operations. */ + private final VirtualMachineImagesClient virtualMachineImages; + + /** + * Gets the VirtualMachineImagesClient object to access its operations. + * + * @return the VirtualMachineImagesClient object. + */ + public VirtualMachineImagesClient getVirtualMachineImages() { + return this.virtualMachineImages; + } + + /** The VirtualMachineImagesEdgeZonesClient object to access its operations. */ + private final VirtualMachineImagesEdgeZonesClient virtualMachineImagesEdgeZones; + + /** + * Gets the VirtualMachineImagesEdgeZonesClient object to access its operations. + * + * @return the VirtualMachineImagesEdgeZonesClient object. + */ + public VirtualMachineImagesEdgeZonesClient getVirtualMachineImagesEdgeZones() { + return this.virtualMachineImagesEdgeZones; + } + + /** The UsagesClient object to access its operations. */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** The VirtualMachinesClient object to access its operations. */ + private final VirtualMachinesClient virtualMachines; + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + public VirtualMachinesClient getVirtualMachines() { + return this.virtualMachines; + } + + /** The VirtualMachineScaleSetsClient object to access its operations. */ + private final VirtualMachineScaleSetsClient virtualMachineScaleSets; + + /** + * Gets the VirtualMachineScaleSetsClient object to access its operations. + * + * @return the VirtualMachineScaleSetsClient object. + */ + public VirtualMachineScaleSetsClient getVirtualMachineScaleSets() { + return this.virtualMachineScaleSets; + } + + /** The VirtualMachineSizesClient object to access its operations. */ + private final VirtualMachineSizesClient virtualMachineSizes; + + /** + * Gets the VirtualMachineSizesClient object to access its operations. + * + * @return the VirtualMachineSizesClient object. + */ + public VirtualMachineSizesClient getVirtualMachineSizes() { + return this.virtualMachineSizes; + } + + /** The ImagesClient object to access its operations. */ + private final ImagesClient images; + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + public ImagesClient getImages() { + return this.images; + } + + /** The RestorePointCollectionsClient object to access its operations. */ + private final RestorePointCollectionsClient restorePointCollections; + + /** + * Gets the RestorePointCollectionsClient object to access its operations. + * + * @return the RestorePointCollectionsClient object. + */ + public RestorePointCollectionsClient getRestorePointCollections() { + return this.restorePointCollections; + } + + /** The RestorePointsClient object to access its operations. */ + private final RestorePointsClient restorePoints; + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + public RestorePointsClient getRestorePoints() { + return this.restorePoints; + } + + /** The CapacityReservationGroupsClient object to access its operations. */ + private final CapacityReservationGroupsClient capacityReservationGroups; + + /** + * Gets the CapacityReservationGroupsClient object to access its operations. + * + * @return the CapacityReservationGroupsClient object. + */ + public CapacityReservationGroupsClient getCapacityReservationGroups() { + return this.capacityReservationGroups; + } + + /** The CapacityReservationsClient object to access its operations. */ + private final CapacityReservationsClient capacityReservations; + + /** + * Gets the CapacityReservationsClient object to access its operations. + * + * @return the CapacityReservationsClient object. + */ + public CapacityReservationsClient getCapacityReservations() { + return this.capacityReservations; + } + + /** The VirtualMachineScaleSetExtensionsClient object to access its operations. */ + private final VirtualMachineScaleSetExtensionsClient virtualMachineScaleSetExtensions; + + /** + * Gets the VirtualMachineScaleSetExtensionsClient object to access its operations. + * + * @return the VirtualMachineScaleSetExtensionsClient object. + */ + public VirtualMachineScaleSetExtensionsClient getVirtualMachineScaleSetExtensions() { + return this.virtualMachineScaleSetExtensions; + } + + /** The VirtualMachineScaleSetRollingUpgradesClient object to access its operations. */ + private final VirtualMachineScaleSetRollingUpgradesClient virtualMachineScaleSetRollingUpgrades; + + /** + * Gets the VirtualMachineScaleSetRollingUpgradesClient object to access its operations. + * + * @return the VirtualMachineScaleSetRollingUpgradesClient object. + */ + public VirtualMachineScaleSetRollingUpgradesClient getVirtualMachineScaleSetRollingUpgrades() { + return this.virtualMachineScaleSetRollingUpgrades; + } + + /** The VirtualMachineScaleSetVMExtensionsClient object to access its operations. */ + private final VirtualMachineScaleSetVMExtensionsClient virtualMachineScaleSetVMExtensions; + + /** + * Gets the VirtualMachineScaleSetVMExtensionsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMExtensionsClient object. + */ + public VirtualMachineScaleSetVMExtensionsClient getVirtualMachineScaleSetVMExtensions() { + return this.virtualMachineScaleSetVMExtensions; + } + + /** The VirtualMachineScaleSetVMsClient object to access its operations. */ + private final VirtualMachineScaleSetVMsClient virtualMachineScaleSetVMs; + + /** + * Gets the VirtualMachineScaleSetVMsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMsClient object. + */ + public VirtualMachineScaleSetVMsClient getVirtualMachineScaleSetVMs() { + return this.virtualMachineScaleSetVMs; + } + + /** The LogAnalyticsClient object to access its operations. */ + private final LogAnalyticsClient logAnalytics; + + /** + * Gets the LogAnalyticsClient object to access its operations. + * + * @return the LogAnalyticsClient object. + */ + public LogAnalyticsClient getLogAnalytics() { + return this.logAnalytics; + } + + /** The VirtualMachineRunCommandsClient object to access its operations. */ + private final VirtualMachineRunCommandsClient virtualMachineRunCommands; + + /** + * Gets the VirtualMachineRunCommandsClient object to access its operations. + * + * @return the VirtualMachineRunCommandsClient object. + */ + public VirtualMachineRunCommandsClient getVirtualMachineRunCommands() { + return this.virtualMachineRunCommands; + } + + /** The VirtualMachineScaleSetVMRunCommandsClient object to access its operations. */ + private final VirtualMachineScaleSetVMRunCommandsClient virtualMachineScaleSetVMRunCommands; + + /** + * Gets the VirtualMachineScaleSetVMRunCommandsClient object to access its operations. + * + * @return the VirtualMachineScaleSetVMRunCommandsClient object. + */ + public VirtualMachineScaleSetVMRunCommandsClient getVirtualMachineScaleSetVMRunCommands() { + return this.virtualMachineScaleSetVMRunCommands; + } + + /** The ResourceSkusClient object to access its operations. */ + private final ResourceSkusClient resourceSkus; + + /** + * Gets the ResourceSkusClient object to access its operations. + * + * @return the ResourceSkusClient object. + */ + public ResourceSkusClient getResourceSkus() { + return this.resourceSkus; + } + + /** The DisksClient object to access its operations. */ + private final DisksClient disks; + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + public DisksClient getDisks() { + return this.disks; + } + + /** The SnapshotsClient object to access its operations. */ + private final SnapshotsClient snapshots; + + /** + * Gets the SnapshotsClient object to access its operations. + * + * @return the SnapshotsClient object. + */ + public SnapshotsClient getSnapshots() { + return this.snapshots; + } + + /** The DiskEncryptionSetsClient object to access its operations. */ + private final DiskEncryptionSetsClient diskEncryptionSets; + + /** + * Gets the DiskEncryptionSetsClient object to access its operations. + * + * @return the DiskEncryptionSetsClient object. + */ + public DiskEncryptionSetsClient getDiskEncryptionSets() { + return this.diskEncryptionSets; + } + + /** The DiskAccessesClient object to access its operations. */ + private final DiskAccessesClient diskAccesses; + + /** + * Gets the DiskAccessesClient object to access its operations. + * + * @return the DiskAccessesClient object. + */ + public DiskAccessesClient getDiskAccesses() { + return this.diskAccesses; + } + + /** The DiskRestorePointsClient object to access its operations. */ + private final DiskRestorePointsClient diskRestorePoints; + + /** + * Gets the DiskRestorePointsClient object to access its operations. + * + * @return the DiskRestorePointsClient object. + */ + public DiskRestorePointsClient getDiskRestorePoints() { + return this.diskRestorePoints; + } + + /** The GalleriesClient object to access its operations. */ + private final GalleriesClient galleries; + + /** + * Gets the GalleriesClient object to access its operations. + * + * @return the GalleriesClient object. + */ + public GalleriesClient getGalleries() { + return this.galleries; + } + + /** 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 GalleryImageVersionsClient object to access its operations. */ + private final GalleryImageVersionsClient galleryImageVersions; + + /** + * Gets the GalleryImageVersionsClient object to access its operations. + * + * @return the GalleryImageVersionsClient object. + */ + public GalleryImageVersionsClient getGalleryImageVersions() { + return this.galleryImageVersions; + } + + /** The GalleryApplicationsClient object to access its operations. */ + private final GalleryApplicationsClient galleryApplications; + + /** + * Gets the GalleryApplicationsClient object to access its operations. + * + * @return the GalleryApplicationsClient object. + */ + public GalleryApplicationsClient getGalleryApplications() { + return this.galleryApplications; + } + + /** The GalleryApplicationVersionsClient object to access its operations. */ + private final GalleryApplicationVersionsClient galleryApplicationVersions; + + /** + * Gets the GalleryApplicationVersionsClient object to access its operations. + * + * @return the GalleryApplicationVersionsClient object. + */ + public GalleryApplicationVersionsClient getGalleryApplicationVersions() { + return this.galleryApplicationVersions; + } + + /** The GallerySharingProfilesClient object to access its operations. */ + private final GallerySharingProfilesClient gallerySharingProfiles; + + /** + * Gets the GallerySharingProfilesClient object to access its operations. + * + * @return the GallerySharingProfilesClient object. + */ + public GallerySharingProfilesClient getGallerySharingProfiles() { + return this.gallerySharingProfiles; + } + + /** The SharedGalleriesClient object to access its operations. */ + private final SharedGalleriesClient sharedGalleries; + + /** + * Gets the SharedGalleriesClient object to access its operations. + * + * @return the SharedGalleriesClient object. + */ + public SharedGalleriesClient getSharedGalleries() { + return this.sharedGalleries; + } + + /** The SharedGalleryImagesClient object to access its operations. */ + private final SharedGalleryImagesClient sharedGalleryImages; + + /** + * Gets the SharedGalleryImagesClient object to access its operations. + * + * @return the SharedGalleryImagesClient object. + */ + public SharedGalleryImagesClient getSharedGalleryImages() { + return this.sharedGalleryImages; + } + + /** The SharedGalleryImageVersionsClient object to access its operations. */ + private final SharedGalleryImageVersionsClient sharedGalleryImageVersions; + + /** + * Gets the SharedGalleryImageVersionsClient object to access its operations. + * + * @return the SharedGalleryImageVersionsClient object. + */ + public SharedGalleryImageVersionsClient getSharedGalleryImageVersions() { + return this.sharedGalleryImageVersions; + } + + /** The CommunityGalleriesClient object to access its operations. */ + private final CommunityGalleriesClient communityGalleries; + + /** + * Gets the CommunityGalleriesClient object to access its operations. + * + * @return the CommunityGalleriesClient object. + */ + public CommunityGalleriesClient getCommunityGalleries() { + return this.communityGalleries; + } + + /** The CommunityGalleryImagesClient object to access its operations. */ + private final CommunityGalleryImagesClient communityGalleryImages; + + /** + * Gets the CommunityGalleryImagesClient object to access its operations. + * + * @return the CommunityGalleryImagesClient object. + */ + public CommunityGalleryImagesClient getCommunityGalleryImages() { + return this.communityGalleryImages; + } + + /** The CommunityGalleryImageVersionsClient object to access its operations. */ + private final CommunityGalleryImageVersionsClient communityGalleryImageVersions; + + /** + * Gets the CommunityGalleryImageVersionsClient object to access its operations. + * + * @return the CommunityGalleryImageVersionsClient object. + */ + public CommunityGalleryImageVersionsClient getCommunityGalleryImageVersions() { + return this.communityGalleryImageVersions; + } + + /** The CloudServiceRoleInstancesClient object to access its operations. */ + private final CloudServiceRoleInstancesClient cloudServiceRoleInstances; + + /** + * Gets the CloudServiceRoleInstancesClient object to access its operations. + * + * @return the CloudServiceRoleInstancesClient object. + */ + public CloudServiceRoleInstancesClient getCloudServiceRoleInstances() { + return this.cloudServiceRoleInstances; + } + + /** The CloudServiceRolesClient object to access its operations. */ + private final CloudServiceRolesClient cloudServiceRoles; + + /** + * Gets the CloudServiceRolesClient object to access its operations. + * + * @return the CloudServiceRolesClient object. + */ + public CloudServiceRolesClient getCloudServiceRoles() { + return this.cloudServiceRoles; + } + + /** The CloudServicesClient object to access its operations. */ + private final CloudServicesClient cloudServices; + + /** + * Gets the CloudServicesClient object to access its operations. + * + * @return the CloudServicesClient object. + */ + public CloudServicesClient getCloudServices() { + return this.cloudServices; + } + + /** The CloudServicesUpdateDomainsClient object to access its operations. */ + private final CloudServicesUpdateDomainsClient cloudServicesUpdateDomains; + + /** + * Gets the CloudServicesUpdateDomainsClient object to access its operations. + * + * @return the CloudServicesUpdateDomainsClient object. + */ + public CloudServicesUpdateDomainsClient getCloudServicesUpdateDomains() { + return this.cloudServicesUpdateDomains; + } + + /** The CloudServiceOperatingSystemsClient object to access its operations. */ + private final CloudServiceOperatingSystemsClient cloudServiceOperatingSystems; + + /** + * Gets the CloudServiceOperatingSystemsClient object to access its operations. + * + * @return the CloudServiceOperatingSystemsClient object. + */ + public CloudServiceOperatingSystemsClient getCloudServiceOperatingSystems() { + return this.cloudServiceOperatingSystems; + } + + /** + * Initializes an instance of ComputeManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + ComputeManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.operations = new OperationsClientImpl(this); + this.availabilitySets = new AvailabilitySetsClientImpl(this); + this.proximityPlacementGroups = new ProximityPlacementGroupsClientImpl(this); + this.dedicatedHostGroups = new DedicatedHostGroupsClientImpl(this); + this.dedicatedHosts = new DedicatedHostsClientImpl(this); + this.sshPublicKeys = new SshPublicKeysClientImpl(this); + this.virtualMachineExtensionImages = new VirtualMachineExtensionImagesClientImpl(this); + this.virtualMachineExtensions = new VirtualMachineExtensionsClientImpl(this); + this.virtualMachineImages = new VirtualMachineImagesClientImpl(this); + this.virtualMachineImagesEdgeZones = new VirtualMachineImagesEdgeZonesClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.virtualMachines = new VirtualMachinesClientImpl(this); + this.virtualMachineScaleSets = new VirtualMachineScaleSetsClientImpl(this); + this.virtualMachineSizes = new VirtualMachineSizesClientImpl(this); + this.images = new ImagesClientImpl(this); + this.restorePointCollections = new RestorePointCollectionsClientImpl(this); + this.restorePoints = new RestorePointsClientImpl(this); + this.capacityReservationGroups = new CapacityReservationGroupsClientImpl(this); + this.capacityReservations = new CapacityReservationsClientImpl(this); + this.virtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsClientImpl(this); + this.virtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesClientImpl(this); + this.virtualMachineScaleSetVMExtensions = new VirtualMachineScaleSetVMExtensionsClientImpl(this); + this.virtualMachineScaleSetVMs = new VirtualMachineScaleSetVMsClientImpl(this); + this.logAnalytics = new LogAnalyticsClientImpl(this); + this.virtualMachineRunCommands = new VirtualMachineRunCommandsClientImpl(this); + this.virtualMachineScaleSetVMRunCommands = new VirtualMachineScaleSetVMRunCommandsClientImpl(this); + this.resourceSkus = new ResourceSkusClientImpl(this); + this.disks = new DisksClientImpl(this); + this.snapshots = new SnapshotsClientImpl(this); + this.diskEncryptionSets = new DiskEncryptionSetsClientImpl(this); + this.diskAccesses = new DiskAccessesClientImpl(this); + this.diskRestorePoints = new DiskRestorePointsClientImpl(this); + this.galleries = new GalleriesClientImpl(this); + this.galleryImages = new GalleryImagesClientImpl(this); + this.galleryImageVersions = new GalleryImageVersionsClientImpl(this); + this.galleryApplications = new GalleryApplicationsClientImpl(this); + this.galleryApplicationVersions = new GalleryApplicationVersionsClientImpl(this); + this.gallerySharingProfiles = new GallerySharingProfilesClientImpl(this); + this.sharedGalleries = new SharedGalleriesClientImpl(this); + this.sharedGalleryImages = new SharedGalleryImagesClientImpl(this); + this.sharedGalleryImageVersions = new SharedGalleryImageVersionsClientImpl(this); + this.communityGalleries = new CommunityGalleriesClientImpl(this); + this.communityGalleryImages = new CommunityGalleryImagesClientImpl(this); + this.communityGalleryImageVersions = new CommunityGalleryImageVersionsClientImpl(this); + this.cloudServiceRoleInstances = new CloudServiceRoleInstancesClientImpl(this); + this.cloudServiceRoles = new CloudServiceRolesClientImpl(this); + this.cloudServices = new CloudServicesClientImpl(this); + this.cloudServicesUpdateDomains = new CloudServicesUpdateDomainsClientImpl(this); + this.cloudServiceOperatingSystems = new CloudServiceOperatingSystemsClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(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)); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeOperationValueImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeOperationValueImpl.java new file mode 100644 index 0000000000000..161e30ab1bb0c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ComputeOperationValueImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; +import com.azure.resourcemanager.compute.generated.models.ComputeOperationValue; + +public final class ComputeOperationValueImpl implements ComputeOperationValue { + private ComputeOperationValueInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + ComputeOperationValueImpl( + ComputeOperationValueInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String origin() { + return this.innerModel().origin(); + } + + public String name() { + return this.innerModel().name(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String resource() { + return this.innerModel().resource(); + } + + public String description() { + return this.innerModel().description(); + } + + public String provider() { + return this.innerModel().provider(); + } + + public ComputeOperationValueInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupImpl.java new file mode 100644 index 0000000000000..0121d16654c8e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroup; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupInstanceView; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DedicatedHostGroupImpl + implements DedicatedHostGroup, DedicatedHostGroup.Definition, DedicatedHostGroup.Update { + private DedicatedHostGroupInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public int platformFaultDomainCount() { + return this.innerModel().platformFaultDomainCount(); + } + + public List hosts() { + List inner = this.innerModel().hosts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DedicatedHostGroupInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Boolean supportAutomaticPlacement() { + return this.innerModel().supportAutomaticPlacement(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DedicatedHostGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String hostGroupName; + + private DedicatedHostGroupUpdate updateParameters; + + public DedicatedHostGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DedicatedHostGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .createOrUpdateWithResponse(resourceGroupName, hostGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DedicatedHostGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .createOrUpdateWithResponse(resourceGroupName, hostGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + DedicatedHostGroupImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new DedicatedHostGroupInner(); + this.serviceManager = serviceManager; + this.hostGroupName = name; + } + + public DedicatedHostGroupImpl update() { + this.updateParameters = new DedicatedHostGroupUpdate(); + return this; + } + + public DedicatedHostGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .updateWithResponse(resourceGroupName, hostGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public DedicatedHostGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .updateWithResponse(resourceGroupName, hostGroupName, updateParameters, context) + .getValue(); + return this; + } + + DedicatedHostGroupImpl( + DedicatedHostGroupInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.hostGroupName = Utils.getValueFromIdByName(innerObject.id(), "hostGroups"); + } + + public DedicatedHostGroup refresh() { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .getByResourceGroupWithResponse(resourceGroupName, hostGroupName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public DedicatedHostGroup refresh(Context context) { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHostGroups() + .getByResourceGroupWithResponse(resourceGroupName, hostGroupName, localExpand, context) + .getValue(); + return this; + } + + public DedicatedHostGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DedicatedHostGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DedicatedHostGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public DedicatedHostGroupImpl withZones(List zones) { + if (isInCreateMode()) { + this.innerModel().withZones(zones); + return this; + } else { + this.updateParameters.withZones(zones); + return this; + } + } + + public DedicatedHostGroupImpl withPlatformFaultDomainCount(int platformFaultDomainCount) { + if (isInCreateMode()) { + this.innerModel().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } else { + this.updateParameters.withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + } + + public DedicatedHostGroupImpl withSupportAutomaticPlacement(Boolean supportAutomaticPlacement) { + if (isInCreateMode()) { + this.innerModel().withSupportAutomaticPlacement(supportAutomaticPlacement); + return this; + } else { + this.updateParameters.withSupportAutomaticPlacement(supportAutomaticPlacement); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsClientImpl.java new file mode 100644 index 0000000000000..3d7fd8151f8e8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsClientImpl.java @@ -0,0 +1,1328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.DedicatedHostGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupListResult; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DedicatedHostGroupsClient. */ +public final class DedicatedHostGroupsClientImpl implements DedicatedHostGroupsClient { + private final ClientLogger logger = new ClientLogger(DedicatedHostGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DedicatedHostGroupsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DedicatedHostGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DedicatedHostGroupsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(DedicatedHostGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDedicatedHostGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DedicatedHostGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DedicatedHostGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DedicatedHostGroupUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @QueryParam("$expand") InstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @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.Compute/hostGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostGroupInner createOrUpdate( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, hostGroupName, parameters).block(); + } + + /** + * Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see + * [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596). + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Create Dedicated Host Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String hostGroupName, DedicatedHostGroupInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, parameters, context).block(); + } + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, hostGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostGroupInner update( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters) { + return updateAsync(resourceGroupName, hostGroupName, parameters).block(); + } + + /** + * Update an dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param parameters Parameters supplied to the Update Dedicated Host Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String hostGroupName, DedicatedHostGroupUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, hostGroupName, parameters, context).block(); + } + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 hostGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 hostGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName) { + return deleteWithResponseAsync(resourceGroupName, hostGroupName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName) { + deleteAsync(resourceGroupName, hostGroupName).block(); + } + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String hostGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, hostGroupName, context).block(); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostGroupName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String hostGroupName) { + final InstanceViewTypes expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, hostGroupName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostGroupInner getByResourceGroup(String resourceGroupName, String hostGroupName) { + final InstanceViewTypes expand = null; + return getByResourceGroupAsync(resourceGroupName, hostGroupName, expand).block(); + } + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostGroupName, expand, context).block(); + } + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsImpl.java new file mode 100644 index 0000000000000..db85c45b9b49b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostGroupsImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DedicatedHostGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroup; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroups; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DedicatedHostGroupsImpl implements DedicatedHostGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupsImpl.class); + + private final DedicatedHostGroupsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DedicatedHostGroupsImpl( + DedicatedHostGroupsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String hostGroupName) { + this.serviceClient().delete(resourceGroupName, hostGroupName); + } + + public Response deleteWithResponse(String resourceGroupName, String hostGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, hostGroupName, context); + } + + public DedicatedHostGroup getByResourceGroup(String resourceGroupName, String hostGroupName) { + DedicatedHostGroupInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, hostGroupName); + if (inner != null) { + return new DedicatedHostGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, hostGroupName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DedicatedHostGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DedicatedHostGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DedicatedHostGroupImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DedicatedHostGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DedicatedHostGroupImpl(inner1, this.manager())); + } + + public DedicatedHostGroup getById(String id) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + InstanceViewTypes localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, hostGroupName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, hostGroupName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + this.deleteWithResponse(resourceGroupName, hostGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + return this.deleteWithResponse(resourceGroupName, hostGroupName, context); + } + + private DedicatedHostGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public DedicatedHostGroupImpl define(String name) { + return new DedicatedHostGroupImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostImpl.java new file mode 100644 index 0000000000000..6842cd07b61ba --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHost; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostInstanceView; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostLicenseTypes; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SubResourceReadOnly; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DedicatedHostImpl implements DedicatedHost, DedicatedHost.Definition, DedicatedHost.Update { + private DedicatedHostInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public Boolean autoReplaceOnFailure() { + return this.innerModel().autoReplaceOnFailure(); + } + + public String hostId() { + return this.innerModel().hostId(); + } + + public List virtualMachines() { + List inner = this.innerModel().virtualMachines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DedicatedHostLicenseTypes licenseType() { + return this.innerModel().licenseType(); + } + + public OffsetDateTime provisioningTime() { + return this.innerModel().provisioningTime(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public DedicatedHostInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DedicatedHostInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String hostGroupName; + + private String hostname; + + private DedicatedHostUpdate updateParameters; + + public DedicatedHostImpl withExistingHostGroup(String resourceGroupName, String hostGroupName) { + this.resourceGroupName = resourceGroupName; + this.hostGroupName = hostGroupName; + return this; + } + + public DedicatedHost create() { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .createOrUpdate(resourceGroupName, hostGroupName, hostname, this.innerModel(), Context.NONE); + return this; + } + + public DedicatedHost create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .createOrUpdate(resourceGroupName, hostGroupName, hostname, this.innerModel(), context); + return this; + } + + DedicatedHostImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new DedicatedHostInner(); + this.serviceManager = serviceManager; + this.hostname = name; + } + + public DedicatedHostImpl update() { + this.updateParameters = new DedicatedHostUpdate(); + return this; + } + + public DedicatedHost apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .update(resourceGroupName, hostGroupName, hostname, updateParameters, Context.NONE); + return this; + } + + public DedicatedHost apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .update(resourceGroupName, hostGroupName, hostname, updateParameters, context); + return this; + } + + DedicatedHostImpl( + DedicatedHostInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.hostGroupName = Utils.getValueFromIdByName(innerObject.id(), "hostGroups"); + this.hostname = Utils.getValueFromIdByName(innerObject.id(), "hosts"); + } + + public DedicatedHost refresh() { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .getWithResponse(resourceGroupName, hostGroupName, hostname, localExpand, Context.NONE) + .getValue(); + return this; + } + + public DedicatedHost refresh(Context context) { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDedicatedHosts() + .getWithResponse(resourceGroupName, hostGroupName, hostname, localExpand, context) + .getValue(); + return this; + } + + public void restart() { + serviceManager.dedicatedHosts().restart(resourceGroupName, hostGroupName, hostname); + } + + public void restart(Context context) { + serviceManager.dedicatedHosts().restart(resourceGroupName, hostGroupName, hostname, context); + } + + public DedicatedHostImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DedicatedHostImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DedicatedHostImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public DedicatedHostImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public DedicatedHostImpl withPlatformFaultDomain(Integer platformFaultDomain) { + if (isInCreateMode()) { + this.innerModel().withPlatformFaultDomain(platformFaultDomain); + return this; + } else { + this.updateParameters.withPlatformFaultDomain(platformFaultDomain); + return this; + } + } + + public DedicatedHostImpl withAutoReplaceOnFailure(Boolean autoReplaceOnFailure) { + if (isInCreateMode()) { + this.innerModel().withAutoReplaceOnFailure(autoReplaceOnFailure); + return this; + } else { + this.updateParameters.withAutoReplaceOnFailure(autoReplaceOnFailure); + return this; + } + } + + public DedicatedHostImpl withLicenseType(DedicatedHostLicenseTypes licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsClientImpl.java new file mode 100644 index 0000000000000..886b646d09e6f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsClientImpl.java @@ -0,0 +1,1812 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.DedicatedHostsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostListResult; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostUpdate; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +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 DedicatedHostsClient. */ +public final class DedicatedHostsClientImpl implements DedicatedHostsClient { + private final ClientLogger logger = new ClientLogger(DedicatedHostsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DedicatedHostsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DedicatedHostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DedicatedHostsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(DedicatedHostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDedicatedHosts to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DedicatedHostsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts/{hostName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DedicatedHostInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts/{hostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DedicatedHostUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts/{hostName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts/{hostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @PathParam("hostName") String hostname, + @QueryParam("$expand") InstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByHostGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + + "/{hostGroupName}/hosts/{hostName}/restart") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostGroupName") String hostGroupName, + @PathParam("hostName") String hostname, + @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(ApiErrorException.class) + Mono> listByHostGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DedicatedHostInner> beginCreateOrUpdateAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DedicatedHostInner.class, + DedicatedHostInner.class, + this.client.getContext()); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DedicatedHostInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DedicatedHostInner.class, DedicatedHostInner.class, context); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DedicatedHostInner> beginCreateOrUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).getSyncPoller(); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DedicatedHostInner> beginCreateOrUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context) + .getSyncPoller(); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostInner createOrUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostInner parameters) { + return createOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).block(); + } + + /** + * Create or update a dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Create Dedicated Host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostInner createOrUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).block(); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DedicatedHostInner> beginUpdateAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DedicatedHostInner.class, + DedicatedHostInner.class, + this.client.getContext()); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DedicatedHostInner> beginUpdateAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, hostGroupName, hostname, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DedicatedHostInner.class, DedicatedHostInner.class, context); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DedicatedHostInner> beginUpdate( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters) { + return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters).getSyncPoller(); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DedicatedHostInner> beginUpdate( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).getSyncPoller(); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters) { + return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, hostGroupName, hostname, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostInner update( + String resourceGroupName, String hostGroupName, String hostname, DedicatedHostUpdate parameters) { + return updateAsync(resourceGroupName, hostGroupName, hostname, parameters).block(); + } + + /** + * Update an dedicated host . + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host . + * @param parameters Parameters supplied to the Update Dedicated Host operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostInner update( + String resourceGroupName, + String hostGroupName, + String hostname, + DedicatedHostUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, hostGroupName, hostname, parameters, context).block(); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 hostGroupName, String hostname) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 hostGroupName, String hostname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String hostGroupName, String hostname) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, hostGroupName, hostname); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String hostGroupName, String hostname, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, hostGroupName, hostname, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String hostGroupName, String hostname) { + return beginDeleteAsync(resourceGroupName, hostGroupName, hostname).getSyncPoller(); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String hostGroupName, String hostname, Context context) { + return beginDeleteAsync(resourceGroupName, hostGroupName, hostname, context).getSyncPoller(); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName, String hostname) { + return beginDeleteAsync(resourceGroupName, hostGroupName, hostname) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName, String hostname, Context context) { + return beginDeleteAsync(resourceGroupName, hostGroupName, hostname, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName, String hostname) { + deleteAsync(resourceGroupName, hostGroupName, hostname).block(); + } + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 hostGroupName, String hostname, Context context) { + deleteAsync(resourceGroupName, hostGroupName, hostname, context).block(); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand) { + return getWithResponseAsync(resourceGroupName, hostGroupName, hostname, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String hostGroupName, String hostname) { + final InstanceViewTypes expand = null; + return getWithResponseAsync(resourceGroupName, hostGroupName, hostname, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DedicatedHostInner get(String resourceGroupName, String hostGroupName, String hostname) { + final InstanceViewTypes expand = null; + return getAsync(resourceGroupName, hostGroupName, hostname, expand).block(); + } + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand, Context context) { + return getWithResponseAsync(resourceGroupName, hostGroupName, hostname, expand, context).block(); + } + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostGroupSinglePageAsync( + String resourceGroupName, String hostGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHostGroup( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + 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 dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostGroupSinglePageAsync( + String resourceGroupName, String hostGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHostGroup( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostGroupAsync(String resourceGroupName, String hostGroupName) { + return new PagedFlux<>( + () -> listByHostGroupSinglePageAsync(resourceGroupName, hostGroupName), + nextLink -> listByHostGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostGroupAsync( + String resourceGroupName, String hostGroupName, Context context) { + return new PagedFlux<>( + () -> listByHostGroupSinglePageAsync(resourceGroupName, hostGroupName, context), + nextLink -> listByHostGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName) { + return new PagedIterable<>(listByHostGroupAsync(resourceGroupName, hostGroupName)); + } + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostGroup( + String resourceGroupName, String hostGroupName, Context context) { + return new PagedIterable<>(listByHostGroupAsync(resourceGroupName, hostGroupName, context)); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String hostGroupName, String hostname) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String hostGroupName, String hostname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + hostGroupName, + hostname, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String hostGroupName, String hostname) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, hostGroupName, hostname); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String hostGroupName, String hostname, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, hostGroupName, hostname, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String hostGroupName, String hostname) { + return beginRestartAsync(resourceGroupName, hostGroupName, hostname).getSyncPoller(); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String hostGroupName, String hostname, Context context) { + return beginRestartAsync(resourceGroupName, hostGroupName, hostname, context).getSyncPoller(); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname) { + return beginRestartAsync(resourceGroupName, hostGroupName, hostname) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname, Context context) { + return beginRestartAsync(resourceGroupName, hostGroupName, hostname, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname) { + restartAsync(resourceGroupName, hostGroupName, hostname).block(); + } + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname, Context context) { + restartAsync(resourceGroupName, hostGroupName, hostname, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostGroupNextSinglePageAsync(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.listByHostGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHostGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsImpl.java new file mode 100644 index 0000000000000..dc1ecec9f615a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DedicatedHostsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DedicatedHostsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner; +import com.azure.resourcemanager.compute.generated.models.DedicatedHost; +import com.azure.resourcemanager.compute.generated.models.DedicatedHosts; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DedicatedHostsImpl implements DedicatedHosts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostsImpl.class); + + private final DedicatedHostsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DedicatedHostsImpl( + DedicatedHostsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String hostGroupName, String hostname) { + this.serviceClient().delete(resourceGroupName, hostGroupName, hostname); + } + + public void delete(String resourceGroupName, String hostGroupName, String hostname, Context context) { + this.serviceClient().delete(resourceGroupName, hostGroupName, hostname, context); + } + + public DedicatedHost get(String resourceGroupName, String hostGroupName, String hostname) { + DedicatedHostInner inner = this.serviceClient().get(resourceGroupName, hostGroupName, hostname); + if (inner != null) { + return new DedicatedHostImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, hostGroupName, hostname, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DedicatedHostImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName) { + PagedIterable inner = + this.serviceClient().listByHostGroup(resourceGroupName, hostGroupName); + return Utils.mapPage(inner, inner1 -> new DedicatedHostImpl(inner1, this.manager())); + } + + public PagedIterable listByHostGroup( + String resourceGroupName, String hostGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByHostGroup(resourceGroupName, hostGroupName, context); + return Utils.mapPage(inner, inner1 -> new DedicatedHostImpl(inner1, this.manager())); + } + + public void restart(String resourceGroupName, String hostGroupName, String hostname) { + this.serviceClient().restart(resourceGroupName, hostGroupName, hostname); + } + + public void restart(String resourceGroupName, String hostGroupName, String hostname, Context context) { + this.serviceClient().restart(resourceGroupName, hostGroupName, hostname, context); + } + + public DedicatedHost getById(String id) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + String hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + InstanceViewTypes localExpand = null; + return this.getWithResponse(resourceGroupName, hostGroupName, hostname, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + String hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + return this.getWithResponse(resourceGroupName, hostGroupName, hostname, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + String hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + this.delete(resourceGroupName, hostGroupName, hostname, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 hostGroupName = Utils.getValueFromIdByName(id, "hostGroups"); + if (hostGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostGroups'.", id))); + } + String hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + this.delete(resourceGroupName, hostGroupName, hostname, context); + } + + private DedicatedHostsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public DedicatedHostImpl define(String name) { + return new DedicatedHostImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessImpl.java new file mode 100644 index 0000000000000..5f444234023ea --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.models.DiskAccess; +import com.azure.resourcemanager.compute.generated.models.DiskAccessUpdate; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnection; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class DiskAccessImpl implements DiskAccess, DiskAccess.Definition, DiskAccess.Update { + private DiskAccessInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DiskAccessInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String diskAccessName; + + private DiskAccessUpdate updateDiskAccess; + + public DiskAccessImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DiskAccess create() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .createOrUpdate(resourceGroupName, diskAccessName, this.innerModel(), Context.NONE); + return this; + } + + public DiskAccess create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .createOrUpdate(resourceGroupName, diskAccessName, this.innerModel(), context); + return this; + } + + DiskAccessImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new DiskAccessInner(); + this.serviceManager = serviceManager; + this.diskAccessName = name; + } + + public DiskAccessImpl update() { + this.updateDiskAccess = new DiskAccessUpdate(); + return this; + } + + public DiskAccess apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .update(resourceGroupName, diskAccessName, updateDiskAccess, Context.NONE); + return this; + } + + public DiskAccess apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .update(resourceGroupName, diskAccessName, updateDiskAccess, context); + return this; + } + + DiskAccessImpl( + DiskAccessInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.diskAccessName = Utils.getValueFromIdByName(innerObject.id(), "diskAccesses"); + } + + public DiskAccess refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .getByResourceGroupWithResponse(resourceGroupName, diskAccessName, Context.NONE) + .getValue(); + return this; + } + + public DiskAccess refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskAccesses() + .getByResourceGroupWithResponse(resourceGroupName, diskAccessName, context) + .getValue(); + return this; + } + + public DiskAccessImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiskAccessImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiskAccessImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDiskAccess.withTags(tags); + return this; + } + } + + public DiskAccessImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesClientImpl.java new file mode 100644 index 0000000000000..1365ee97f5303 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesClientImpl.java @@ -0,0 +1,3031 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.DiskAccessesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.DiskAccessList; +import com.azure.resourcemanager.compute.generated.models.DiskAccessUpdate; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnectionListResult; +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 DiskAccessesClient. */ +public final class DiskAccessesClientImpl implements DiskAccessesClient { + private final ClientLogger logger = new ClientLogger(DiskAccessesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DiskAccessesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DiskAccessesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiskAccessesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(DiskAccessesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDiskAccesses to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DiskAccessesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskAccessInner diskAccess, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskAccessUpdate diskAccess, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPrivateLinkResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> updateAPrivateEndpointConnection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getAPrivateEndpointConnection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deleteAPrivateEndpointConnection( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskAccesses/{diskAccessName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listPrivateEndpointConnections( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskAccessName") String diskAccessName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listPrivateEndpointConnectionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (diskAccess == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccess is required and cannot be null.")); + } else { + diskAccess.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + diskAccess, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (diskAccess == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccess is required and cannot be null.")); + } else { + diskAccess.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + diskAccess, + accept, + context); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessInner> beginCreateOrUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, diskAccessName, diskAccess); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskAccessInner.class, + DiskAccessInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessInner> beginCreateOrUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, diskAccessName, diskAccess, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskAccessInner.class, DiskAccessInner.class, context); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessInner> beginCreateOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess) { + return beginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).getSyncPoller(); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessInner> beginCreateOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess, context).getSyncPoller(); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess) { + return beginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessInner createOrUpdate(String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess) { + return createOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess).block(); + } + + /** + * Creates or updates a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Put disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessInner createOrUpdate( + String resourceGroupName, String diskAccessName, DiskAccessInner diskAccess, Context context) { + return createOrUpdateAsync(resourceGroupName, diskAccessName, diskAccess, context).block(); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (diskAccess == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccess is required and cannot be null.")); + } else { + diskAccess.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + diskAccess, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (diskAccess == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccess is required and cannot be null.")); + } else { + diskAccess.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + diskAccess, + accept, + context); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessInner> beginUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, diskAccessName, diskAccess); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskAccessInner.class, + DiskAccessInner.class, + this.client.getContext()); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessInner> beginUpdateAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, diskAccessName, diskAccess, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskAccessInner.class, DiskAccessInner.class, context); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessInner> beginUpdate( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess) { + return beginUpdateAsync(resourceGroupName, diskAccessName, diskAccess).getSyncPoller(); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessInner> beginUpdate( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context) { + return beginUpdateAsync(resourceGroupName, diskAccessName, diskAccess, context).getSyncPoller(); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess) { + return beginUpdateAsync(resourceGroupName, diskAccessName, diskAccess) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context) { + return beginUpdateAsync(resourceGroupName, diskAccessName, diskAccess, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessInner update(String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess) { + return updateAsync(resourceGroupName, diskAccessName, diskAccess).block(); + } + + /** + * Updates (patches) a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param diskAccess disk access object supplied in the body of the Patch disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessInner update( + String resourceGroupName, String diskAccessName, DiskAccessUpdate diskAccess, Context context) { + return updateAsync(resourceGroupName, diskAccessName, diskAccess, context).block(); + } + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String diskAccessName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String diskAccessName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context); + } + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String diskAccessName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskAccessName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessInner getByResourceGroup(String resourceGroupName, String diskAccessName) { + return getByResourceGroupAsync(resourceGroupName, diskAccessName).block(); + } + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String diskAccessName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskAccessName, context).block(); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 diskAccessName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 diskAccessName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String diskAccessName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskAccessName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String diskAccessName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskAccessName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String diskAccessName) { + return beginDeleteAsync(resourceGroupName, diskAccessName).getSyncPoller(); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String diskAccessName, Context context) { + return beginDeleteAsync(resourceGroupName, diskAccessName, context).getSyncPoller(); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskAccessName) { + return beginDeleteAsync(resourceGroupName, diskAccessName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskAccessName, Context context) { + return beginDeleteAsync(resourceGroupName, diskAccessName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskAccessName) { + deleteAsync(resourceGroupName, diskAccessName).block(); + } + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskAccessName, Context context) { + deleteAsync(resourceGroupName, diskAccessName, context).block(); + } + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the disk access resources under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, 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 the disk access resources under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disk access resources under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disk access resources under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disk access resources under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the disk access resources under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String diskAccessName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String diskAccessName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context); + } + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPrivateLinkResourcesAsync( + String resourceGroupName, String diskAccessName) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, diskAccessName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceListResultInner getPrivateLinkResources(String resourceGroupName, String diskAccessName) { + return getPrivateLinkResourcesAsync(resourceGroupName, diskAccessName).block(); + } + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String diskAccessName, Context context) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, diskAccessName, context).block(); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + privateEndpointConnection, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + privateEndpointConnection, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnectionAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + Mono>> mono = + updateAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnectionAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginUpdateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> + beginUpdateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginUpdateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAPrivateEndpointConnectionAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginUpdateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAPrivateEndpointConnectionAsync( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginUpdateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return updateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection) + .block(); + } + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return updateAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, context) + .block(); + } + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + accept, + context); + } + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAPrivateEndpointConnectionAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + return getAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner getAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + return getAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName) + .block(); + } + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAPrivateEndpointConnectionWithResponse( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + return getAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteAPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteAPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + apiVersion, + accept, + context); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAPrivateEndpointConnectionAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + Mono>> mono = + deleteAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAPrivateEndpointConnectionAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteAPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + return beginDeleteAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName) + .getSyncPoller(); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + return beginDeleteAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteAPrivateEndpointConnectionAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + return beginDeleteAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteAPrivateEndpointConnectionAsync( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + return beginDeleteAPrivateEndpointConnectionAsync( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + deleteAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + deleteAPrivateEndpointConnectionAsync(resourceGroupName, diskAccessName, privateEndpointConnectionName, context) + .block(); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsSinglePageAsync( + String resourceGroupName, String diskAccessName) { + 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 (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsSinglePageAsync( + String resourceGroupName, String diskAccessName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskAccessName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskAccessName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskAccessName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listPrivateEndpointConnectionsAsync( + String resourceGroupName, String diskAccessName) { + return new PagedFlux<>( + () -> listPrivateEndpointConnectionsSinglePageAsync(resourceGroupName, diskAccessName), + nextLink -> listPrivateEndpointConnectionsNextSinglePageAsync(nextLink)); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listPrivateEndpointConnectionsAsync( + String resourceGroupName, String diskAccessName, Context context) { + return new PagedFlux<>( + () -> listPrivateEndpointConnectionsSinglePageAsync(resourceGroupName, diskAccessName, context), + nextLink -> listPrivateEndpointConnectionsNextSinglePageAsync(nextLink, context)); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName) { + return new PagedIterable<>(listPrivateEndpointConnectionsAsync(resourceGroupName, diskAccessName)); + } + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName, Context context) { + return new PagedIterable<>(listPrivateEndpointConnectionsAsync(resourceGroupName, diskAccessName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsNextSinglePageAsync( + 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.listPrivateEndpointConnectionsNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateEndpointConnectionsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesImpl.java new file mode 100644 index 0000000000000..075b2fe067c28 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskAccessesImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DiskAccessesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.compute.generated.models.DiskAccess; +import com.azure.resourcemanager.compute.generated.models.DiskAccesses; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkResourceListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiskAccessesImpl implements DiskAccesses { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskAccessesImpl.class); + + private final DiskAccessesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DiskAccessesImpl( + DiskAccessesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DiskAccess getByResourceGroup(String resourceGroupName, String diskAccessName) { + DiskAccessInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, diskAccessName); + if (inner != null) { + return new DiskAccessImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String diskAccessName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, diskAccessName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskAccessImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String diskAccessName) { + this.serviceClient().delete(resourceGroupName, diskAccessName); + } + + public void delete(String resourceGroupName, String diskAccessName, Context context) { + this.serviceClient().delete(resourceGroupName, diskAccessName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DiskAccessImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DiskAccessImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DiskAccessImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DiskAccessImpl(inner1, this.manager())); + } + + public PrivateLinkResourceListResult getPrivateLinkResources(String resourceGroupName, String diskAccessName) { + PrivateLinkResourceListResultInner inner = + this.serviceClient().getPrivateLinkResources(resourceGroupName, diskAccessName); + if (inner != null) { + return new PrivateLinkResourceListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String diskAccessName, Context context) { + Response inner = + this.serviceClient().getPrivateLinkResourcesWithResponse(resourceGroupName, diskAccessName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .updateAPrivateEndpointConnection( + resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .updateAPrivateEndpointConnection( + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + privateEndpointConnection, + context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection getAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .getAPrivateEndpointConnection(resourceGroupName, diskAccessName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAPrivateEndpointConnectionWithResponse( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getAPrivateEndpointConnectionWithResponse( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName) { + this + .serviceClient() + .deleteAPrivateEndpointConnection(resourceGroupName, diskAccessName, privateEndpointConnectionName); + } + + public void deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context) { + this + .serviceClient() + .deleteAPrivateEndpointConnection( + resourceGroupName, diskAccessName, privateEndpointConnectionName, context); + } + + public PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName) { + PagedIterable inner = + this.serviceClient().listPrivateEndpointConnections(resourceGroupName, diskAccessName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName, Context context) { + PagedIterable inner = + this.serviceClient().listPrivateEndpointConnections(resourceGroupName, diskAccessName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public DiskAccess getById(String id) { + String resourceGroupName = Utils.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 diskAccessName = Utils.getValueFromIdByName(id, "diskAccesses"); + if (diskAccessName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diskAccesses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskAccessName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskAccessName = Utils.getValueFromIdByName(id, "diskAccesses"); + if (diskAccessName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diskAccesses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskAccessName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 diskAccessName = Utils.getValueFromIdByName(id, "diskAccesses"); + if (diskAccessName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diskAccesses'.", id))); + } + this.delete(resourceGroupName, diskAccessName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskAccessName = Utils.getValueFromIdByName(id, "diskAccesses"); + if (diskAccessName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diskAccesses'.", id))); + } + this.delete(resourceGroupName, diskAccessName, context); + } + + private DiskAccessesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public DiskAccessImpl define(String name) { + return new DiskAccessImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetImpl.java new file mode 100644 index 0000000000000..2191398afa30b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetUpdate; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DiskEncryptionSetImpl + implements DiskEncryptionSet, DiskEncryptionSet.Definition, DiskEncryptionSet.Update { + private DiskEncryptionSetInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 EncryptionSetIdentity identity() { + return this.innerModel().identity(); + } + + public DiskEncryptionSetType encryptionType() { + return this.innerModel().encryptionType(); + } + + public KeyForDiskEncryptionSet activeKey() { + return this.innerModel().activeKey(); + } + + public List previousKeys() { + List inner = this.innerModel().previousKeys(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Boolean rotationToLatestKeyVersionEnabled() { + return this.innerModel().rotationToLatestKeyVersionEnabled(); + } + + public OffsetDateTime lastKeyRotationTimestamp() { + return this.innerModel().lastKeyRotationTimestamp(); + } + + public ApiError autoKeyRotationError() { + return this.innerModel().autoKeyRotationError(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DiskEncryptionSetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String diskEncryptionSetName; + + private DiskEncryptionSetUpdate updateDiskEncryptionSet; + + public DiskEncryptionSetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DiskEncryptionSet create() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .createOrUpdate(resourceGroupName, diskEncryptionSetName, this.innerModel(), Context.NONE); + return this; + } + + public DiskEncryptionSet create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .createOrUpdate(resourceGroupName, diskEncryptionSetName, this.innerModel(), context); + return this; + } + + DiskEncryptionSetImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new DiskEncryptionSetInner(); + this.serviceManager = serviceManager; + this.diskEncryptionSetName = name; + } + + public DiskEncryptionSetImpl update() { + this.updateDiskEncryptionSet = new DiskEncryptionSetUpdate(); + return this; + } + + public DiskEncryptionSet apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .update(resourceGroupName, diskEncryptionSetName, updateDiskEncryptionSet, Context.NONE); + return this; + } + + public DiskEncryptionSet apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .update(resourceGroupName, diskEncryptionSetName, updateDiskEncryptionSet, context); + return this; + } + + DiskEncryptionSetImpl( + DiskEncryptionSetInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.diskEncryptionSetName = Utils.getValueFromIdByName(innerObject.id(), "diskEncryptionSets"); + } + + public DiskEncryptionSet refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .getByResourceGroupWithResponse(resourceGroupName, diskEncryptionSetName, Context.NONE) + .getValue(); + return this; + } + + public DiskEncryptionSet refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiskEncryptionSets() + .getByResourceGroupWithResponse(resourceGroupName, diskEncryptionSetName, context) + .getValue(); + return this; + } + + public DiskEncryptionSetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiskEncryptionSetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiskEncryptionSetImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDiskEncryptionSet.withTags(tags); + return this; + } + } + + public DiskEncryptionSetImpl withIdentity(EncryptionSetIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateDiskEncryptionSet.withIdentity(identity); + return this; + } + } + + public DiskEncryptionSetImpl withEncryptionType(DiskEncryptionSetType encryptionType) { + if (isInCreateMode()) { + this.innerModel().withEncryptionType(encryptionType); + return this; + } else { + this.updateDiskEncryptionSet.withEncryptionType(encryptionType); + return this; + } + } + + public DiskEncryptionSetImpl withActiveKey(KeyForDiskEncryptionSet activeKey) { + if (isInCreateMode()) { + this.innerModel().withActiveKey(activeKey); + return this; + } else { + this.updateDiskEncryptionSet.withActiveKey(activeKey); + return this; + } + } + + public DiskEncryptionSetImpl withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + if (isInCreateMode()) { + this.innerModel().withRotationToLatestKeyVersionEnabled(rotationToLatestKeyVersionEnabled); + return this; + } else { + this.updateDiskEncryptionSet.withRotationToLatestKeyVersionEnabled(rotationToLatestKeyVersionEnabled); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsClientImpl.java new file mode 100644 index 0000000000000..094bb2b80877d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsClientImpl.java @@ -0,0 +1,1993 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.DiskEncryptionSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetList; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetUpdate; +import com.azure.resourcemanager.compute.generated.models.ResourceUriList; +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 DiskEncryptionSetsClient. */ +public final class DiskEncryptionSetsClientImpl implements DiskEncryptionSetsClient { + private final ClientLogger logger = new ClientLogger(DiskEncryptionSetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DiskEncryptionSetsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DiskEncryptionSetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiskEncryptionSetsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(DiskEncryptionSetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDiskEncryptionSets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DiskEncryptionSetsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets/{diskEncryptionSetName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskEncryptionSetName") String diskEncryptionSetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskEncryptionSetInner diskEncryptionSet, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets/{diskEncryptionSetName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskEncryptionSetName") String diskEncryptionSetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskEncryptionSetUpdate diskEncryptionSet, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets/{diskEncryptionSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskEncryptionSetName") String diskEncryptionSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets/{diskEncryptionSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskEncryptionSetName") String diskEncryptionSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAssociatedResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskEncryptionSetName") String diskEncryptionSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAssociatedResourcesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet) { + 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 (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + if (diskEncryptionSet == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSet is required and cannot be null.")); + } else { + diskEncryptionSet.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + diskEncryptionSet, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + if (diskEncryptionSet == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSet is required and cannot be null.")); + } else { + diskEncryptionSet.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + diskEncryptionSet, + accept, + context); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskEncryptionSetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskEncryptionSetInner.class, + DiskEncryptionSetInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskEncryptionSetInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskEncryptionSetInner.class, + DiskEncryptionSetInner.class, + context); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskEncryptionSetInner> beginCreateOrUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet) { + return beginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).getSyncPoller(); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskEncryptionSetInner> beginCreateOrUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context) + .getSyncPoller(); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet) { + return beginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskEncryptionSetInner createOrUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetInner diskEncryptionSet) { + return createOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).block(); + } + + /** + * Creates or updates a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Put disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskEncryptionSetInner createOrUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetInner diskEncryptionSet, + Context context) { + return createOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context).block(); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { + 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 (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + if (diskEncryptionSet == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSet is required and cannot be null.")); + } else { + diskEncryptionSet.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + diskEncryptionSet, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + if (diskEncryptionSet == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSet is required and cannot be null.")); + } else { + diskEncryptionSet.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + diskEncryptionSet, + accept, + context); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskEncryptionSetInner> beginUpdateAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskEncryptionSetInner.class, + DiskEncryptionSetInner.class, + this.client.getContext()); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskEncryptionSetInner> beginUpdateAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskEncryptionSetInner.class, + DiskEncryptionSetInner.class, + context); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskEncryptionSetInner> beginUpdate( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { + return beginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).getSyncPoller(); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskEncryptionSetInner> beginUpdate( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context) { + return beginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context).getSyncPoller(); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { + return beginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context) { + return beginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskEncryptionSetInner update( + String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { + return updateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).block(); + } + + /** + * Updates (patches) a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param diskEncryptionSet disk encryption set object supplied in the body of the Patch disk encryption set + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk encryption set resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskEncryptionSetInner update( + String resourceGroupName, + String diskEncryptionSetName, + DiskEncryptionSetUpdate diskEncryptionSet, + Context context) { + return updateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, context).block(); + } + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String diskEncryptionSetName) { + 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 (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String diskEncryptionSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + accept, + context); + } + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String diskEncryptionSetName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskEncryptionSetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskEncryptionSetInner getByResourceGroup(String resourceGroupName, String diskEncryptionSetName) { + return getByResourceGroupAsync(resourceGroupName, diskEncryptionSetName).block(); + } + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String diskEncryptionSetName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskEncryptionSetName, context).block(); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 diskEncryptionSetName) { + 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 (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 diskEncryptionSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + accept, + context); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String diskEncryptionSetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskEncryptionSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String diskEncryptionSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, diskEncryptionSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String diskEncryptionSetName) { + return beginDeleteAsync(resourceGroupName, diskEncryptionSetName).getSyncPoller(); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String diskEncryptionSetName, Context context) { + return beginDeleteAsync(resourceGroupName, diskEncryptionSetName, context).getSyncPoller(); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskEncryptionSetName) { + return beginDeleteAsync(resourceGroupName, diskEncryptionSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskEncryptionSetName, Context context) { + return beginDeleteAsync(resourceGroupName, diskEncryptionSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskEncryptionSetName) { + deleteAsync(resourceGroupName, diskEncryptionSetName).block(); + } + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 diskEncryptionSetName, Context context) { + deleteAsync(resourceGroupName, diskEncryptionSetName, context).block(); + } + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the disk encryption sets under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, 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 the disk encryption sets under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disk encryption sets under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disk encryption sets under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disk encryption sets under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the disk encryption sets under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAssociatedResourcesSinglePageAsync( + String resourceGroupName, String diskEncryptionSetName) { + 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 (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAssociatedResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + 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 resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAssociatedResourcesSinglePageAsync( + String resourceGroupName, String diskEncryptionSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskEncryptionSetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAssociatedResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskEncryptionSetName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAssociatedResourcesAsync(String resourceGroupName, String diskEncryptionSetName) { + return new PagedFlux<>( + () -> listAssociatedResourcesSinglePageAsync(resourceGroupName, diskEncryptionSetName), + nextLink -> listAssociatedResourcesNextSinglePageAsync(nextLink)); + } + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAssociatedResourcesAsync( + String resourceGroupName, String diskEncryptionSetName, Context context) { + return new PagedFlux<>( + () -> listAssociatedResourcesSinglePageAsync(resourceGroupName, diskEncryptionSetName, context), + nextLink -> listAssociatedResourcesNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAssociatedResources(String resourceGroupName, String diskEncryptionSetName) { + return new PagedIterable<>(listAssociatedResourcesAsync(resourceGroupName, diskEncryptionSetName)); + } + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAssociatedResources( + String resourceGroupName, String diskEncryptionSetName, Context context) { + return new PagedIterable<>(listAssociatedResourcesAsync(resourceGroupName, diskEncryptionSetName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAssociatedResourcesNextSinglePageAsync(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.listAssociatedResourcesNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAssociatedResourcesNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAssociatedResourcesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsImpl.java new file mode 100644 index 0000000000000..da6de895f4150 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskEncryptionSetsImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DiskEncryptionSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiskEncryptionSetsImpl implements DiskEncryptionSets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetsImpl.class); + + private final DiskEncryptionSetsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DiskEncryptionSetsImpl( + DiskEncryptionSetsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DiskEncryptionSet getByResourceGroup(String resourceGroupName, String diskEncryptionSetName) { + DiskEncryptionSetInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, diskEncryptionSetName); + if (inner != null) { + return new DiskEncryptionSetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String diskEncryptionSetName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, diskEncryptionSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskEncryptionSetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String diskEncryptionSetName) { + this.serviceClient().delete(resourceGroupName, diskEncryptionSetName); + } + + public void delete(String resourceGroupName, String diskEncryptionSetName, Context context) { + this.serviceClient().delete(resourceGroupName, diskEncryptionSetName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DiskEncryptionSetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DiskEncryptionSetImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DiskEncryptionSetImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DiskEncryptionSetImpl(inner1, this.manager())); + } + + public PagedIterable listAssociatedResources(String resourceGroupName, String diskEncryptionSetName) { + return this.serviceClient().listAssociatedResources(resourceGroupName, diskEncryptionSetName); + } + + public PagedIterable listAssociatedResources( + String resourceGroupName, String diskEncryptionSetName, Context context) { + return this.serviceClient().listAssociatedResources(resourceGroupName, diskEncryptionSetName, context); + } + + public DiskEncryptionSet getById(String id) { + String resourceGroupName = Utils.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 diskEncryptionSetName = Utils.getValueFromIdByName(id, "diskEncryptionSets"); + if (diskEncryptionSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diskEncryptionSets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskEncryptionSetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskEncryptionSetName = Utils.getValueFromIdByName(id, "diskEncryptionSets"); + if (diskEncryptionSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diskEncryptionSets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskEncryptionSetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 diskEncryptionSetName = Utils.getValueFromIdByName(id, "diskEncryptionSets"); + if (diskEncryptionSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diskEncryptionSets'.", id))); + } + this.delete(resourceGroupName, diskEncryptionSetName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskEncryptionSetName = Utils.getValueFromIdByName(id, "diskEncryptionSets"); + if (diskEncryptionSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diskEncryptionSets'.", id))); + } + this.delete(resourceGroupName, diskEncryptionSetName, context); + } + + private DiskEncryptionSetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public DiskEncryptionSetImpl define(String name) { + return new DiskEncryptionSetImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskImpl.java new file mode 100644 index 0000000000000..cfe8fe5988beb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskImpl.java @@ -0,0 +1,555 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.Disk; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskSku; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.DiskUpdate; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PropertyUpdatesInProgress; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.ShareInfoElement; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DiskImpl implements Disk, Disk.Definition, Disk.Update { + private DiskInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public List managedByExtended() { + List inner = this.innerModel().managedByExtended(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiskSku sku() { + return this.innerModel().sku(); + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public SupportedCapabilities supportedCapabilities() { + return this.innerModel().supportedCapabilities(); + } + + public CreationData creationData() { + return this.innerModel().creationData(); + } + + public Integer diskSizeGB() { + return this.innerModel().diskSizeGB(); + } + + public Long diskSizeBytes() { + return this.innerModel().diskSizeBytes(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerModel().encryptionSettingsCollection(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Long diskIopsReadWrite() { + return this.innerModel().diskIopsReadWrite(); + } + + public Long diskMBpsReadWrite() { + return this.innerModel().diskMBpsReadWrite(); + } + + public Long diskIopsReadOnly() { + return this.innerModel().diskIopsReadOnly(); + } + + public Long diskMBpsReadOnly() { + return this.innerModel().diskMBpsReadOnly(); + } + + public DiskState diskState() { + return this.innerModel().diskState(); + } + + public Encryption encryption() { + return this.innerModel().encryption(); + } + + public Integer maxShares() { + return this.innerModel().maxShares(); + } + + public List shareInfo() { + List inner = this.innerModel().shareInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerModel().networkAccessPolicy(); + } + + public String diskAccessId() { + return this.innerModel().diskAccessId(); + } + + public String tier() { + return this.innerModel().tier(); + } + + public Boolean burstingEnabled() { + return this.innerModel().burstingEnabled(); + } + + public PropertyUpdatesInProgress propertyUpdatesInProgress() { + return this.innerModel().propertyUpdatesInProgress(); + } + + public Boolean supportsHibernation() { + return this.innerModel().supportsHibernation(); + } + + public DiskSecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public Float completionPercent() { + return this.innerModel().completionPercent(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DiskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String diskName; + + private DiskUpdate updateDisk; + + public DiskImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Disk create() { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), Context.NONE); + return this; + } + + public Disk create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), context); + return this; + } + + DiskImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new DiskInner(); + this.serviceManager = serviceManager; + this.diskName = name; + } + + public DiskImpl update() { + this.updateDisk = new DiskUpdate(); + return this; + } + + public Disk apply() { + this.innerObject = + serviceManager.serviceClient().getDisks().update(resourceGroupName, diskName, updateDisk, Context.NONE); + return this; + } + + public Disk apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getDisks().update(resourceGroupName, diskName, updateDisk, context); + return this; + } + + DiskImpl(DiskInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.diskName = Utils.getValueFromIdByName(innerObject.id(), "disks"); + } + + public Disk refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE) + .getValue(); + return this; + } + + public Disk refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .getByResourceGroupWithResponse(resourceGroupName, diskName, context) + .getValue(); + return this; + } + + public AccessUri grantAccess(GrantAccessData grantAccessData) { + return serviceManager.disks().grantAccess(resourceGroupName, diskName, grantAccessData); + } + + public AccessUri grantAccess(GrantAccessData grantAccessData, Context context) { + return serviceManager.disks().grantAccess(resourceGroupName, diskName, grantAccessData, context); + } + + public void revokeAccess() { + serviceManager.disks().revokeAccess(resourceGroupName, diskName); + } + + public void revokeAccess(Context context) { + serviceManager.disks().revokeAccess(resourceGroupName, diskName, context); + } + + public DiskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiskImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDisk.withTags(tags); + return this; + } + } + + public DiskImpl withSku(DiskSku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateDisk.withSku(sku); + return this; + } + } + + public DiskImpl withZones(List zones) { + this.innerModel().withZones(zones); + return this; + } + + public DiskImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public DiskImpl withOsType(OperatingSystemTypes osType) { + if (isInCreateMode()) { + this.innerModel().withOsType(osType); + return this; + } else { + this.updateDisk.withOsType(osType); + return this; + } + } + + public DiskImpl withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.innerModel().withHyperVGeneration(hyperVGeneration); + return this; + } + + public DiskImpl withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + if (isInCreateMode()) { + this.innerModel().withPurchasePlan(purchasePlan); + return this; + } else { + this.updateDisk.withPurchasePlan(purchasePlan); + return this; + } + } + + public DiskImpl withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (isInCreateMode()) { + this.innerModel().withSupportedCapabilities(supportedCapabilities); + return this; + } else { + this.updateDisk.withSupportedCapabilities(supportedCapabilities); + return this; + } + } + + public DiskImpl withCreationData(CreationData creationData) { + this.innerModel().withCreationData(creationData); + return this; + } + + public DiskImpl withDiskSizeGB(Integer diskSizeGB) { + if (isInCreateMode()) { + this.innerModel().withDiskSizeGB(diskSizeGB); + return this; + } else { + this.updateDisk.withDiskSizeGB(diskSizeGB); + return this; + } + } + + public DiskImpl withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (isInCreateMode()) { + this.innerModel().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } else { + this.updateDisk.withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + } + + public DiskImpl withDiskIopsReadWrite(Long diskIopsReadWrite) { + if (isInCreateMode()) { + this.innerModel().withDiskIopsReadWrite(diskIopsReadWrite); + return this; + } else { + this.updateDisk.withDiskIopsReadWrite(diskIopsReadWrite); + return this; + } + } + + public DiskImpl withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + if (isInCreateMode()) { + this.innerModel().withDiskMBpsReadWrite(diskMBpsReadWrite); + return this; + } else { + this.updateDisk.withDiskMBpsReadWrite(diskMBpsReadWrite); + return this; + } + } + + public DiskImpl withDiskIopsReadOnly(Long diskIopsReadOnly) { + if (isInCreateMode()) { + this.innerModel().withDiskIopsReadOnly(diskIopsReadOnly); + return this; + } else { + this.updateDisk.withDiskIopsReadOnly(diskIopsReadOnly); + return this; + } + } + + public DiskImpl withDiskMBpsReadOnly(Long diskMBpsReadOnly) { + if (isInCreateMode()) { + this.innerModel().withDiskMBpsReadOnly(diskMBpsReadOnly); + return this; + } else { + this.updateDisk.withDiskMBpsReadOnly(diskMBpsReadOnly); + return this; + } + } + + public DiskImpl withEncryption(Encryption encryption) { + if (isInCreateMode()) { + this.innerModel().withEncryption(encryption); + return this; + } else { + this.updateDisk.withEncryption(encryption); + return this; + } + } + + public DiskImpl withMaxShares(Integer maxShares) { + if (isInCreateMode()) { + this.innerModel().withMaxShares(maxShares); + return this; + } else { + this.updateDisk.withMaxShares(maxShares); + return this; + } + } + + public DiskImpl withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (isInCreateMode()) { + this.innerModel().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } else { + this.updateDisk.withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + } + + public DiskImpl withDiskAccessId(String diskAccessId) { + if (isInCreateMode()) { + this.innerModel().withDiskAccessId(diskAccessId); + return this; + } else { + this.updateDisk.withDiskAccessId(diskAccessId); + return this; + } + } + + public DiskImpl withTier(String tier) { + if (isInCreateMode()) { + this.innerModel().withTier(tier); + return this; + } else { + this.updateDisk.withTier(tier); + return this; + } + } + + public DiskImpl withBurstingEnabled(Boolean burstingEnabled) { + if (isInCreateMode()) { + this.innerModel().withBurstingEnabled(burstingEnabled); + return this; + } else { + this.updateDisk.withBurstingEnabled(burstingEnabled); + return this; + } + } + + public DiskImpl withSupportsHibernation(Boolean supportsHibernation) { + if (isInCreateMode()) { + this.innerModel().withSupportsHibernation(supportsHibernation); + return this; + } else { + this.updateDisk.withSupportsHibernation(supportsHibernation); + return this; + } + } + + public DiskImpl withSecurityProfile(DiskSecurityProfile securityProfile) { + this.innerModel().withSecurityProfile(securityProfile); + return this; + } + + public DiskImpl withCompletionPercent(Float completionPercent) { + this.innerModel().withCompletionPercent(completionPercent); + return this; + } + + public DiskImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateDisk.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointImpl.java new file mode 100644 index 0000000000000..504bb9a299c8b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import com.azure.resourcemanager.compute.generated.models.DiskRestorePoint; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import java.time.OffsetDateTime; + +public final class DiskRestorePointImpl implements DiskRestorePoint { + private DiskRestorePointInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + DiskRestorePointImpl( + DiskRestorePointInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public SupportedCapabilities supportedCapabilities() { + return this.innerModel().supportedCapabilities(); + } + + public String familyId() { + return this.innerModel().familyId(); + } + + public String sourceUniqueId() { + return this.innerModel().sourceUniqueId(); + } + + public Encryption encryption() { + return this.innerModel().encryption(); + } + + public Boolean supportsHibernation() { + return this.innerModel().supportsHibernation(); + } + + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerModel().networkAccessPolicy(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public String diskAccessId() { + return this.innerModel().diskAccessId(); + } + + public Float completionPercent() { + return this.innerModel().completionPercent(); + } + + public String replicationState() { + return this.innerModel().replicationState(); + } + + public String sourceResourceLocation() { + return this.innerModel().sourceResourceLocation(); + } + + public DiskRestorePointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsClientImpl.java new file mode 100644 index 0000000000000..e7baca31f4b7f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsClientImpl.java @@ -0,0 +1,1392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +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.polling.PollResult; +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.compute.generated.fluent.DiskRestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.DiskRestorePointList; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +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 DiskRestorePointsClient. */ +public final class DiskRestorePointsClientImpl implements DiskRestorePointsClient { + private final ClientLogger logger = new ClientLogger(DiskRestorePointsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DiskRestorePointsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DiskRestorePointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiskRestorePointsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(DiskRestorePointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDiskRestorePoints to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DiskRestorePointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}" + + "/diskRestorePoints/{diskRestorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("vmRestorePointName") String vmRestorePointName, + @PathParam("diskRestorePointName") String diskRestorePointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}" + + "/diskRestorePoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByRestorePoint( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("vmRestorePointName") String vmRestorePointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}" + + "/diskRestorePoints/{diskRestorePointName}/beginGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> grantAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("vmRestorePointName") String vmRestorePointName, + @PathParam("diskRestorePointName") String diskRestorePointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GrantAccessData grantAccessData, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}" + + "/diskRestorePoints/{diskRestorePointName}/endGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> revokeAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("vmRestorePointName") String vmRestorePointName, + @PathParam("diskRestorePointName") String diskRestorePointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByRestorePointNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + accept, + context); + } + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + return getWithResponseAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskRestorePointInner get( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + return getAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName) + .block(); + } + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + return getWithResponseAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context) + .block(); + } + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRestorePointSinglePageAsync( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByRestorePoint( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + apiVersion, + 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 diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRestorePointSinglePageAsync( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRestorePoint( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorePointAsync( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName) { + return new PagedFlux<>( + () -> listByRestorePointSinglePageAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName), + nextLink -> listByRestorePointNextSinglePageAsync(nextLink)); + } + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorePointAsync( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context) { + return new PagedFlux<>( + () -> + listByRestorePointSinglePageAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, context), + nextLink -> listByRestorePointNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName) { + return new PagedIterable<>( + listByRestorePointAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName)); + } + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context) { + return new PagedIterable<>( + listByRestorePointAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, context)); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + grantAccessData, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + grantAccessData, + accept, + context); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + Mono>> mono = + grantAccessWithResponseAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccessUriInner.class, + AccessUriInner.class, + this.client.getContext()); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + grantAccessWithResponseAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccessUriInner.class, AccessUriInner.class, context); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + return beginGrantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData) + .getSyncPoller(); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + return beginGrantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + context) + .getSyncPoller(); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + return beginGrantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + return beginGrantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + return grantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData) + .block(); + } + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + return grantAccessAsync( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + context) + .block(); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> revokeAccessWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> revokeAccessWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (vmRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmRestorePointName is required and cannot be null.")); + } + if (diskRestorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter diskRestorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + apiVersion, + accept, + context); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + Mono>> mono = + revokeAccessWithResponseAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + revokeAccessWithResponseAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + return beginRevokeAccessAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName) + .getSyncPoller(); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + return beginRevokeAccessAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context) + .getSyncPoller(); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 revokeAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + return beginRevokeAccessAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 revokeAccessAsync( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + return beginRevokeAccessAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + revokeAccessAsync(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName) + .block(); + } + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + revokeAccessAsync( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRestorePointNextSinglePageAsync(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.listByRestorePointNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRestorePointNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRestorePointNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsImpl.java new file mode 100644 index 0000000000000..b8f934903178f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DiskRestorePointsImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DiskRestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; +import com.azure.resourcemanager.compute.generated.models.DiskRestorePoint; +import com.azure.resourcemanager.compute.generated.models.DiskRestorePoints; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiskRestorePointsImpl implements DiskRestorePoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskRestorePointsImpl.class); + + private final DiskRestorePointsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DiskRestorePointsImpl( + DiskRestorePointsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DiskRestorePoint get( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + DiskRestorePointInner inner = + this + .serviceClient() + .get(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName); + if (inner != null) { + return new DiskRestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskRestorePointImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName) { + PagedIterable inner = + this.serviceClient().listByRestorePoint(resourceGroupName, restorePointCollectionName, vmRestorePointName); + return Utils.mapPage(inner, inner1 -> new DiskRestorePointImpl(inner1, this.manager())); + } + + public PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByRestorePoint(resourceGroupName, restorePointCollectionName, vmRestorePointName, context); + return Utils.mapPage(inner, inner1 -> new DiskRestorePointImpl(inner1, this.manager())); + } + + public AccessUri grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData) { + AccessUriInner inner = + this + .serviceClient() + .grantAccess( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public AccessUri grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context) { + AccessUriInner inner = + this + .serviceClient() + .grantAccess( + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + context); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public void revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName) { + this + .serviceClient() + .revokeAccess(resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName); + } + + public void revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context) { + this + .serviceClient() + .revokeAccess( + resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, context); + } + + private DiskRestorePointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksClientImpl.java new file mode 100644 index 0000000000000..d10f7990977ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksClientImpl.java @@ -0,0 +1,2157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.DisksClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import com.azure.resourcemanager.compute.generated.models.DiskList; +import com.azure.resourcemanager.compute.generated.models.DiskUpdate; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +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 DisksClient. */ +public final class DisksClientImpl implements DisksClient { + private final ClientLogger logger = new ClientLogger(DisksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DisksService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of DisksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DisksClientImpl(ComputeManagementClientImpl client) { + this.service = RestProxy.create(DisksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientDisks to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface DisksService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskInner disk, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskUpdate disk, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}/beginGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> grantAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GrantAccessData grantAccessData, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + + "/{diskName}/endGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revokeAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("diskName") String diskName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String diskName, DiskInner disk) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + disk, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String diskName, DiskInner disk, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + disk, + accept, + context); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskInner> beginCreateOrUpdateAsync( + String resourceGroupName, String diskName, DiskInner disk) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, diskName, disk); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, this.client.getContext()); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskInner> beginCreateOrUpdateAsync( + String resourceGroupName, String diskName, DiskInner disk, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, diskName, disk, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, context); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String diskName, DiskInner disk) { + return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk).getSyncPoller(); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String diskName, DiskInner disk, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk, context).getSyncPoller(); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String diskName, DiskInner disk) { + return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String diskName, DiskInner disk, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk) { + return createOrUpdateAsync(resourceGroupName, diskName, disk).block(); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk, Context context) { + return createOrUpdateAsync(resourceGroupName, diskName, disk, context).block(); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String diskName, DiskUpdate disk) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + disk, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String diskName, DiskUpdate disk, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + disk, + accept, + context); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskInner> beginUpdateAsync( + String resourceGroupName, String diskName, DiskUpdate disk) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, diskName, disk); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, this.client.getContext()); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskInner> beginUpdateAsync( + String resourceGroupName, String diskName, DiskUpdate disk, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, diskName, disk, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, context); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginUpdate( + String resourceGroupName, String diskName, DiskUpdate disk) { + return beginUpdateAsync(resourceGroupName, diskName, disk).getSyncPoller(); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginUpdate( + String resourceGroupName, String diskName, DiskUpdate disk, Context context) { + return beginUpdateAsync(resourceGroupName, diskName, disk, context).getSyncPoller(); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String diskName, DiskUpdate disk) { + return beginUpdateAsync(resourceGroupName, diskName, disk) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String diskName, DiskUpdate disk, Context context) { + return beginUpdateAsync(resourceGroupName, diskName, disk, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk) { + return updateAsync(resourceGroupName, diskName, disk).block(); + } + + /** + * Updates (patches) a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param disk Disk object supplied in the body of the Patch disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk, Context context) { + return updateAsync(resourceGroupName, diskName, disk, context).block(); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String diskName) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String diskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + accept, + context); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String diskName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner getByResourceGroup(String resourceGroupName, String diskName) { + return getByResourceGroupAsync(resourceGroupName, diskName).block(); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String diskName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskName, context).block(); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 diskName) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 diskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + context); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String diskName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String diskName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String diskName) { + return beginDeleteAsync(resourceGroupName, diskName).getSyncPoller(); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String diskName, Context context) { + return beginDeleteAsync(resourceGroupName, diskName, context).getSyncPoller(); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 diskName) { + return beginDeleteAsync(resourceGroupName, diskName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 diskName, Context context) { + return beginDeleteAsync(resourceGroupName, diskName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 diskName) { + deleteAsync(resourceGroupName, diskName).block(); + } + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 diskName, Context context) { + deleteAsync(resourceGroupName, diskName, context).block(); + } + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the disks under 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 the List Disks operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, 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 the disks under 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 the List Disks operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + grantAccessData, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + grantAccessData, + accept, + context); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + Mono>> mono = + grantAccessWithResponseAsync(resourceGroupName, diskName, grantAccessData); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccessUriInner.class, + AccessUriInner.class, + this.client.getContext()); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + grantAccessWithResponseAsync(resourceGroupName, diskName, grantAccessData, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccessUriInner.class, AccessUriInner.class, context); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData).getSyncPoller(); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData, context).getSyncPoller(); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + return grantAccessAsync(resourceGroupName, diskName, grantAccessData).block(); + } + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + return grantAccessAsync(resourceGroupName, diskName, grantAccessData, context).block(); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revokeAccessWithResponseAsync(String resourceGroupName, String diskName) { + 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 (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + return FluxUtil + .withContext( + context -> + service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revokeAccessWithResponseAsync( + String resourceGroupName, String diskName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (diskName == null) { + return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + context = this.client.mergeContext(context); + return service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + diskName, + apiVersion, + context); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String diskName) { + Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, diskName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync( + String resourceGroupName, String diskName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, diskName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String diskName) { + return beginRevokeAccessAsync(resourceGroupName, diskName).getSyncPoller(); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, String diskName, Context context) { + return beginRevokeAccessAsync(resourceGroupName, diskName, context).getSyncPoller(); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revokeAccessAsync(String resourceGroupName, String diskName) { + return beginRevokeAccessAsync(resourceGroupName, diskName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revokeAccessAsync(String resourceGroupName, String diskName, Context context) { + return beginRevokeAccessAsync(resourceGroupName, diskName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revokeAccess(String resourceGroupName, String diskName) { + revokeAccessAsync(resourceGroupName, diskName).block(); + } + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revokeAccess(String resourceGroupName, String diskName, Context context) { + revokeAccessAsync(resourceGroupName, diskName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disks operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disks operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disks operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disks operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksImpl.java new file mode 100644 index 0000000000000..3ef9da45c6942 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/DisksImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.DisksClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; +import com.azure.resourcemanager.compute.generated.models.Disk; +import com.azure.resourcemanager.compute.generated.models.Disks; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DisksImpl implements Disks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DisksImpl.class); + + private final DisksClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public DisksImpl( + DisksClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Disk getByResourceGroup(String resourceGroupName, String diskName) { + DiskInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, diskName); + if (inner != null) { + return new DiskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, diskName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String diskName) { + this.serviceClient().delete(resourceGroupName, diskName); + } + + public void delete(String resourceGroupName, String diskName, Context context) { + this.serviceClient().delete(resourceGroupName, diskName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public AccessUri grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { + AccessUriInner inner = this.serviceClient().grantAccess(resourceGroupName, diskName, grantAccessData); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public AccessUri grantAccess( + String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context) { + AccessUriInner inner = this.serviceClient().grantAccess(resourceGroupName, diskName, grantAccessData, context); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public void revokeAccess(String resourceGroupName, String diskName) { + this.serviceClient().revokeAccess(resourceGroupName, diskName); + } + + public void revokeAccess(String resourceGroupName, String diskName, Context context) { + this.serviceClient().revokeAccess(resourceGroupName, diskName, context); + } + + public Disk getById(String id) { + String resourceGroupName = Utils.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 diskName = Utils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskName = Utils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 diskName = Utils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + this.delete(resourceGroupName, diskName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 diskName = Utils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + this.delete(resourceGroupName, diskName, context); + } + + private DisksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public DiskImpl define(String name) { + return new DiskImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesClientImpl.java new file mode 100644 index 0000000000000..0464d4a3f36db --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesClientImpl.java @@ -0,0 +1,1604 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.GalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.GalleryList; +import com.azure.resourcemanager.compute.generated.models.GalleryUpdate; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; +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 GalleriesClient. */ +public final class GalleriesClientImpl implements GalleriesClient { + private final ClientLogger logger = new ClientLogger(GalleriesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleriesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GalleriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleriesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(GalleriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGalleries to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GalleriesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryInner gallery, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryUpdate gallery, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$select") SelectPermissions select, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String galleryName, GalleryInner gallery) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (gallery == null) { + return Mono.error(new IllegalArgumentException("Parameter gallery is required and cannot be null.")); + } else { + gallery.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + gallery, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (gallery == null) { + return Mono.error(new IllegalArgumentException("Parameter gallery is required and cannot be null.")); + } else { + gallery.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + gallery, + accept, + context); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String galleryName, GalleryInner gallery) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, galleryName, gallery); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, this.client.getContext()); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginCreateOrUpdateAsync( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, galleryName, gallery, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, context); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, GalleryInner gallery) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery).getSyncPoller(); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery, context).getSyncPoller(); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String galleryName, GalleryInner gallery) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, gallery, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner createOrUpdate(String resourceGroupName, String galleryName, GalleryInner gallery) { + return createOrUpdateAsync(resourceGroupName, galleryName, gallery).block(); + } + + /** + * Create or update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the create or update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner createOrUpdate( + String resourceGroupName, String galleryName, GalleryInner gallery, Context context) { + return createOrUpdateAsync(resourceGroupName, galleryName, gallery, context).block(); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String galleryName, GalleryUpdate gallery) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (gallery == null) { + return Mono.error(new IllegalArgumentException("Parameter gallery is required and cannot be null.")); + } else { + gallery.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + gallery, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (gallery == null) { + return Mono.error(new IllegalArgumentException("Parameter gallery is required and cannot be null.")); + } else { + gallery.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + gallery, + accept, + context); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginUpdateAsync( + String resourceGroupName, String galleryName, GalleryUpdate gallery) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, galleryName, gallery); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, this.client.getContext()); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryInner> beginUpdateAsync( + String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, galleryName, gallery, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryInner.class, GalleryInner.class, context); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginUpdate( + String resourceGroupName, String galleryName, GalleryUpdate gallery) { + return beginUpdateAsync(resourceGroupName, galleryName, gallery).getSyncPoller(); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryInner> beginUpdate( + String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, gallery, context).getSyncPoller(); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String galleryName, GalleryUpdate gallery) { + return beginUpdateAsync(resourceGroupName, galleryName, gallery) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, gallery, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner update(String resourceGroupName, String galleryName, GalleryUpdate gallery) { + return updateAsync(resourceGroupName, galleryName, gallery).block(); + } + + /** + * Update a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with + * dots and periods allowed in the middle. The maximum length is 80 characters. + * @param gallery Parameters supplied to the update Shared Image Gallery operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner update(String resourceGroupName, String galleryName, GalleryUpdate gallery, Context context) { + return updateAsync(resourceGroupName, galleryName, gallery, context).block(); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String galleryName, SelectPermissions select) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + select, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String galleryName, SelectPermissions select, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + select, + accept, + context); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String galleryName, SelectPermissions select) { + return getByResourceGroupWithResponseAsync(resourceGroupName, galleryName, select) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String galleryName) { + final SelectPermissions select = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, galleryName, select) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryInner getByResourceGroup(String resourceGroupName, String galleryName) { + final SelectPermissions select = null; + return getByResourceGroupAsync(resourceGroupName, galleryName, select).block(); + } + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String galleryName, SelectPermissions select, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, galleryName, select, context).block(); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String galleryName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, galleryName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, galleryName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String galleryName) { + return beginDeleteAsync(resourceGroupName, galleryName).getSyncPoller(); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, context).getSyncPoller(); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName) { + return beginDeleteAsync(resourceGroupName, galleryName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName) { + deleteAsync(resourceGroupName, galleryName).block(); + } + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, Context context) { + deleteAsync(resourceGroupName, galleryName, context).block(); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response 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 apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List galleries under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response 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 apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List galleries under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List galleries under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List galleries under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List galleries under a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List galleries under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesImpl.java new file mode 100644 index 0000000000000..977ffe0818d67 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleriesImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.GalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner; +import com.azure.resourcemanager.compute.generated.models.Galleries; +import com.azure.resourcemanager.compute.generated.models.Gallery; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleriesImpl implements Galleries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleriesImpl.class); + + private final GalleriesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GalleriesImpl( + GalleriesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Gallery getByResourceGroup(String resourceGroupName, String galleryName) { + GalleryInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, galleryName); + if (inner != null) { + return new GalleryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String galleryName, SelectPermissions select, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, galleryName, select, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String galleryName) { + this.serviceClient().delete(resourceGroupName, galleryName); + } + + public void delete(String resourceGroupName, String galleryName, Context context) { + this.serviceClient().delete(resourceGroupName, galleryName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new GalleryImpl(inner1, this.manager())); + } + + public Gallery getById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + SelectPermissions localSelect = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, galleryName, localSelect, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, SelectPermissions select, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, galleryName, select, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + this.delete(resourceGroupName, galleryName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + this.delete(resourceGroupName, galleryName, context); + } + + private GalleriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public GalleryImpl define(String name) { + return new GalleryImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationImpl.java new file mode 100644 index 0000000000000..af53fd8d16fc4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplication; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationUpdate; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class GalleryApplicationImpl + implements GalleryApplication, GalleryApplication.Definition, GalleryApplication.Update { + private GalleryApplicationInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String description() { + return this.innerModel().description(); + } + + public String eula() { + return this.innerModel().eula(); + } + + public String privacyStatementUri() { + return this.innerModel().privacyStatementUri(); + } + + public String releaseNoteUri() { + return this.innerModel().releaseNoteUri(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public OperatingSystemTypes supportedOSType() { + return this.innerModel().supportedOSType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GalleryApplicationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryName; + + private String galleryApplicationName; + + private GalleryApplicationUpdate updateGalleryApplication; + + public GalleryApplicationImpl withExistingGallery(String resourceGroupName, String galleryName) { + this.resourceGroupName = resourceGroupName; + this.galleryName = galleryName; + return this; + } + + public GalleryApplication create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .createOrUpdate( + resourceGroupName, galleryName, galleryApplicationName, this.innerModel(), Context.NONE); + return this; + } + + public GalleryApplication create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .createOrUpdate(resourceGroupName, galleryName, galleryApplicationName, this.innerModel(), context); + return this; + } + + GalleryApplicationImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new GalleryApplicationInner(); + this.serviceManager = serviceManager; + this.galleryApplicationName = name; + } + + public GalleryApplicationImpl update() { + this.updateGalleryApplication = new GalleryApplicationUpdate(); + return this; + } + + public GalleryApplication apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .update(resourceGroupName, galleryName, galleryApplicationName, updateGalleryApplication, Context.NONE); + return this; + } + + public GalleryApplication apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .update(resourceGroupName, galleryName, galleryApplicationName, updateGalleryApplication, context); + return this; + } + + GalleryApplicationImpl( + GalleryApplicationInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + this.galleryApplicationName = Utils.getValueFromIdByName(innerObject.id(), "applications"); + } + + public GalleryApplication refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .getWithResponse(resourceGroupName, galleryName, galleryApplicationName, Context.NONE) + .getValue(); + return this; + } + + public GalleryApplication refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplications() + .getWithResponse(resourceGroupName, galleryName, galleryApplicationName, context) + .getValue(); + return this; + } + + public GalleryApplicationImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GalleryApplicationImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GalleryApplicationImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateGalleryApplication.withTags(tags); + return this; + } + } + + public GalleryApplicationImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateGalleryApplication.withDescription(description); + return this; + } + } + + public GalleryApplicationImpl withEula(String eula) { + if (isInCreateMode()) { + this.innerModel().withEula(eula); + return this; + } else { + this.updateGalleryApplication.withEula(eula); + return this; + } + } + + public GalleryApplicationImpl withPrivacyStatementUri(String privacyStatementUri) { + if (isInCreateMode()) { + this.innerModel().withPrivacyStatementUri(privacyStatementUri); + return this; + } else { + this.updateGalleryApplication.withPrivacyStatementUri(privacyStatementUri); + return this; + } + } + + public GalleryApplicationImpl withReleaseNoteUri(String releaseNoteUri) { + if (isInCreateMode()) { + this.innerModel().withReleaseNoteUri(releaseNoteUri); + return this; + } else { + this.updateGalleryApplication.withReleaseNoteUri(releaseNoteUri); + return this; + } + } + + public GalleryApplicationImpl withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (isInCreateMode()) { + this.innerModel().withEndOfLifeDate(endOfLifeDate); + return this; + } else { + this.updateGalleryApplication.withEndOfLifeDate(endOfLifeDate); + return this; + } + } + + public GalleryApplicationImpl withSupportedOSType(OperatingSystemTypes supportedOSType) { + if (isInCreateMode()) { + this.innerModel().withSupportedOSType(supportedOSType); + return this; + } else { + this.updateGalleryApplication.withSupportedOSType(supportedOSType); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionImpl.java new file mode 100644 index 0000000000000..9cc7f5607b534 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import java.util.Collections; +import java.util.Map; + +public final class GalleryApplicationVersionImpl + implements GalleryApplicationVersion, GalleryApplicationVersion.Definition, GalleryApplicationVersion.Update { + private GalleryApplicationVersionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 GalleryApplicationVersionPublishingProfile publishingProfile() { + return this.innerModel().publishingProfile(); + } + + public GalleryApplicationVersionPropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ReplicationStatus replicationStatus() { + return this.innerModel().replicationStatus(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GalleryApplicationVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryName; + + private String galleryApplicationName; + + private String galleryApplicationVersionName; + + private GalleryApplicationVersionUpdate updateGalleryApplicationVersion; + + public GalleryApplicationVersionImpl withExistingApplication( + String resourceGroupName, String galleryName, String galleryApplicationName) { + this.resourceGroupName = resourceGroupName; + this.galleryName = galleryName; + this.galleryApplicationName = galleryApplicationName; + return this; + } + + public GalleryApplicationVersion create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .createOrUpdate( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + this.innerModel(), + Context.NONE); + return this; + } + + public GalleryApplicationVersion create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .createOrUpdate( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + this.innerModel(), + context); + return this; + } + + GalleryApplicationVersionImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new GalleryApplicationVersionInner(); + this.serviceManager = serviceManager; + this.galleryApplicationVersionName = name; + } + + public GalleryApplicationVersionImpl update() { + this.updateGalleryApplicationVersion = new GalleryApplicationVersionUpdate(); + return this; + } + + public GalleryApplicationVersion apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .update( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + updateGalleryApplicationVersion, + Context.NONE); + return this; + } + + public GalleryApplicationVersion apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .update( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + updateGalleryApplicationVersion, + context); + return this; + } + + GalleryApplicationVersionImpl( + GalleryApplicationVersionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + this.galleryApplicationName = Utils.getValueFromIdByName(innerObject.id(), "applications"); + this.galleryApplicationVersionName = Utils.getValueFromIdByName(innerObject.id(), "versions"); + } + + public GalleryApplicationVersion refresh() { + ReplicationStatusTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .getWithResponse( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + localExpand, + Context.NONE) + .getValue(); + return this; + } + + public GalleryApplicationVersion refresh(Context context) { + ReplicationStatusTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleryApplicationVersions() + .getWithResponse( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + localExpand, + context) + .getValue(); + return this; + } + + public GalleryApplicationVersionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GalleryApplicationVersionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GalleryApplicationVersionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateGalleryApplicationVersion.withTags(tags); + return this; + } + } + + public GalleryApplicationVersionImpl withPublishingProfile( + GalleryApplicationVersionPublishingProfile publishingProfile) { + if (isInCreateMode()) { + this.innerModel().withPublishingProfile(publishingProfile); + return this; + } else { + this.updateGalleryApplicationVersion.withPublishingProfile(publishingProfile); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsClientImpl.java new file mode 100644 index 0000000000000..14465c6f45852 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsClientImpl.java @@ -0,0 +1,1987 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.GalleryApplicationVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionList; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +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 GalleryApplicationVersionsClient. */ +public final class GalleryApplicationVersionsClientImpl implements GalleryApplicationVersionsClient { + private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleryApplicationVersionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GalleryApplicationVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryApplicationVersionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + GalleryApplicationVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGalleryApplicationVersions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GalleryApplicationVersionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @PathParam("galleryApplicationVersionName") String galleryApplicationVersionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryApplicationVersionInner galleryApplicationVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @PathParam("galleryApplicationVersionName") String galleryApplicationVersionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryApplicationVersionUpdate galleryApplicationVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @PathParam("galleryApplicationVersionName") String galleryApplicationVersionName, + @QueryParam("$expand") ReplicationStatusTypes expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @PathParam("galleryApplicationVersionName") String galleryApplicationVersionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryApplication( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryApplicationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + if (galleryApplicationVersion == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersion is required and cannot be null.")); + } else { + galleryApplicationVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + galleryApplicationVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + if (galleryApplicationVersion == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersion is required and cannot be null.")); + } else { + galleryApplicationVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + galleryApplicationVersion, + accept, + context); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationVersionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationVersionInner.class, + GalleryApplicationVersionInner.class, + this.client.getContext()); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationVersionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationVersionInner.class, + GalleryApplicationVersionInner.class, + context); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion) { + return beginCreateOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .getSyncPoller(); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .getSyncPoller(); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion) { + return beginCreateOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion) { + return createOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .block(); + } + + /** + * Create or update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be created. + * @param galleryApplicationVersionName The name of the gallery Application Version to be created. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the create or update gallery Application Version + * operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionInner galleryApplicationVersion, + Context context) { + return createOrUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .block(); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + if (galleryApplicationVersion == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersion is required and cannot be null.")); + } else { + galleryApplicationVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + galleryApplicationVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + if (galleryApplicationVersion == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersion is required and cannot be null.")); + } else { + galleryApplicationVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + galleryApplicationVersion, + accept, + context); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationVersionInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationVersionInner.class, + GalleryApplicationVersionInner.class, + this.client.getContext()); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationVersionInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationVersionInner.class, + GalleryApplicationVersionInner.class, + context); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion) { + return beginUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .getSyncPoller(); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context) { + return beginUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .getSyncPoller(); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion) { + return beginUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context) { + return beginUpdateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationVersionInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion) { + return updateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion) + .block(); + } + + /** + * Update a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version is + * to be updated. + * @param galleryApplicationVersionName The name of the gallery Application Version to be updated. Needs to follow + * semantic version name pattern: The allowed characters are digit and period. Digits must be within the range + * of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryApplicationVersion Parameters supplied to the update gallery Application Version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationVersionInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + GalleryApplicationVersionUpdate galleryApplicationVersion, + Context context) { + return updateAsync( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + galleryApplicationVersion, + context) + .block(); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + expand, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + expand, + apiVersion, + accept, + context); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand) { + return getWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + final ReplicationStatusTypes expand = null; + return getWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationVersionInner get( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + final ReplicationStatusTypes expand = null; + return getAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand) + .block(); + } + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand, + Context context) { + return getWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand, context) + .block(); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplicationVersionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter galleryApplicationVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + apiVersion, + accept, + context); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName) + .getSyncPoller(); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + return beginDeleteAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context) + .getSyncPoller(); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + return beginDeleteAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + deleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName).block(); + } + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + deleteAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context) + .block(); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryApplicationSinglePageAsync( + String resourceGroupName, String galleryName, String galleryApplicationName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByGalleryApplication( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryApplicationSinglePageAsync( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryApplication( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryApplicationAsync( + String resourceGroupName, String galleryName, String galleryApplicationName) { + return new PagedFlux<>( + () -> listByGalleryApplicationSinglePageAsync(resourceGroupName, galleryName, galleryApplicationName), + nextLink -> listByGalleryApplicationNextSinglePageAsync(nextLink)); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryApplicationAsync( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + return new PagedFlux<>( + () -> + listByGalleryApplicationSinglePageAsync( + resourceGroupName, galleryName, galleryApplicationName, context), + nextLink -> listByGalleryApplicationNextSinglePageAsync(nextLink, context)); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName) { + return new PagedIterable<>( + listByGalleryApplicationAsync(resourceGroupName, galleryName, galleryApplicationName)); + } + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + return new PagedIterable<>( + listByGalleryApplicationAsync(resourceGroupName, galleryName, galleryApplicationName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryApplicationNextSinglePageAsync( + 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.listByGalleryApplicationNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryApplicationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryApplicationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsImpl.java new file mode 100644 index 0000000000000..1be4a16f04b3c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationVersionsImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.GalleryApplicationVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersions; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleryApplicationVersionsImpl implements GalleryApplicationVersions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionsImpl.class); + + private final GalleryApplicationVersionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GalleryApplicationVersionsImpl( + GalleryApplicationVersionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GalleryApplicationVersion get( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + GalleryApplicationVersionInner inner = + this + .serviceClient() + .get(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName); + if (inner != null) { + return new GalleryApplicationVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + expand, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryApplicationVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName) { + this + .serviceClient() + .delete(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName); + } + + public void delete( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context); + } + + public PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName) { + PagedIterable inner = + this.serviceClient().listByGalleryApplication(resourceGroupName, galleryName, galleryApplicationName); + return Utils.mapPage(inner, inner1 -> new GalleryApplicationVersionImpl(inner1, this.manager())); + } + + public PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByGalleryApplication(resourceGroupName, galleryName, galleryApplicationName, context); + return Utils.mapPage(inner, inner1 -> new GalleryApplicationVersionImpl(inner1, this.manager())); + } + + public GalleryApplicationVersion getById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String galleryApplicationVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryApplicationVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + ReplicationStatusTypes localExpand = null; + return this + .getWithResponse( + resourceGroupName, + galleryName, + galleryApplicationName, + galleryApplicationVersionName, + localExpand, + Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, ReplicationStatusTypes expand, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String galleryApplicationVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryApplicationVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this + .getWithResponse( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String galleryApplicationVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryApplicationVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this + .delete( + resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String galleryApplicationVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryApplicationVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, context); + } + + private GalleryApplicationVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public GalleryApplicationVersionImpl define(String name) { + return new GalleryApplicationVersionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsClientImpl.java new file mode 100644 index 0000000000000..b43d32e53f83f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsClientImpl.java @@ -0,0 +1,1623 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.GalleryApplicationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationList; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationUpdate; +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 GalleryApplicationsClient. */ +public final class GalleryApplicationsClientImpl implements GalleryApplicationsClient { + private final ClientLogger logger = new ClientLogger(GalleryApplicationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleryApplicationsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GalleryApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryApplicationsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(GalleryApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGalleryApplications to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GalleryApplicationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryApplicationInner galleryApplication, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryApplicationUpdate galleryApplication, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications/{galleryApplicationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryApplicationName") String galleryApplicationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGallery( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplication == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null.")); + } else { + galleryApplication.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + galleryApplication, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplication == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null.")); + } else { + galleryApplication.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + galleryApplication, + accept, + context); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationInner.class, + GalleryApplicationInner.class, + this.client.getContext()); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationInner.class, + GalleryApplicationInner.class, + context); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication) + .getSyncPoller(); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context) + .getSyncPoller(); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication) { + return createOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).block(); + } + + /** + * Create or update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * created. + * @param galleryApplicationName The name of the gallery Application Definition to be created or updated. The + * allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The + * maximum length is 80 characters. + * @param galleryApplication Parameters supplied to the create or update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationInner galleryApplication, + Context context) { + return createOrUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context) + .block(); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplication == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null.")); + } else { + galleryApplication.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + galleryApplication, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + if (galleryApplication == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryApplication is required and cannot be null.")); + } else { + galleryApplication.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + galleryApplication, + accept, + context); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationInner.class, + GalleryApplicationInner.class, + this.client.getContext()); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryApplicationInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryApplicationInner.class, + GalleryApplicationInner.class, + context); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication) + .getSyncPoller(); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryApplicationInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context) + .getSyncPoller(); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication) { + return updateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication).block(); + } + + /** + * Update a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * updated. + * @param galleryApplicationName The name of the gallery Application Definition to be updated. The allowed + * characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length + * is 80 characters. + * @param galleryApplication Parameters supplied to the update gallery Application operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationInner update( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + GalleryApplicationUpdate galleryApplication, + Context context) { + return updateAsync(resourceGroupName, galleryName, galleryApplicationName, galleryApplication, context).block(); + } + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String galleryName, String galleryApplicationName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context); + } + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String galleryName, String galleryApplicationName) { + return getWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryApplicationInner get(String resourceGroupName, String galleryName, String galleryApplicationName) { + return getAsync(resourceGroupName, galleryName, galleryApplicationName).block(); + } + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + return getWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, context).block(); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, String galleryApplicationName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, String galleryApplicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryApplicationName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryApplicationName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryApplicationName, + apiVersion, + accept, + context); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, String galleryApplicationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryApplicationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryApplicationName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName).getSyncPoller(); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, context).getSyncPoller(); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryApplicationName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryApplicationName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryApplicationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryApplicationName) { + deleteAsync(resourceGroupName, galleryName, galleryApplicationName).block(); + } + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryApplicationName, Context context) { + deleteAsync(resourceGroupName, galleryName, galleryApplicationName, context).block(); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String galleryName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByGallery( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String galleryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGallery( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync(String resourceGroupName, String galleryName) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, galleryName), + nextLink -> listByGalleryNextSinglePageAsync(nextLink)); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync( + String resourceGroupName, String galleryName, Context context) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, galleryName, context), + nextLink -> listByGalleryNextSinglePageAsync(nextLink, context)); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery(String resourceGroupName, String galleryName) { + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName)); + } + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery( + String resourceGroupName, String galleryName, Context context) { + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync(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.listByGalleryNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsImpl.java new file mode 100644 index 0000000000000..181626a0c82c3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryApplicationsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.GalleryApplicationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner; +import com.azure.resourcemanager.compute.generated.models.GalleryApplication; +import com.azure.resourcemanager.compute.generated.models.GalleryApplications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleryApplicationsImpl implements GalleryApplications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationsImpl.class); + + private final GalleryApplicationsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GalleryApplicationsImpl( + GalleryApplicationsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GalleryApplication get(String resourceGroupName, String galleryName, String galleryApplicationName) { + GalleryApplicationInner inner = + this.serviceClient().get(resourceGroupName, galleryName, galleryApplicationName); + if (inner != null) { + return new GalleryApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, galleryName, galleryApplicationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String galleryName, String galleryApplicationName) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryApplicationName); + } + + public void delete(String resourceGroupName, String galleryName, String galleryApplicationName, Context context) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryApplicationName, context); + } + + public PagedIterable listByGallery(String resourceGroupName, String galleryName) { + PagedIterable inner = + this.serviceClient().listByGallery(resourceGroupName, galleryName); + return Utils.mapPage(inner, inner1 -> new GalleryApplicationImpl(inner1, this.manager())); + } + + public PagedIterable listByGallery( + String resourceGroupName, String galleryName, Context context) { + PagedIterable inner = + this.serviceClient().listByGallery(resourceGroupName, galleryName, context); + return Utils.mapPage(inner, inner1 -> new GalleryApplicationImpl(inner1, this.manager())); + } + + public GalleryApplication getById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, galleryName, galleryApplicationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, galleryName, galleryApplicationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryApplicationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryApplicationName = Utils.getValueFromIdByName(id, "applications"); + if (galleryApplicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryApplicationName, context); + } + + private GalleryApplicationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public GalleryApplicationImpl define(String name) { + return new GalleryApplicationImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageImpl.java new file mode 100644 index 0000000000000..ac2f487a01c2c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageImpl.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryImagePropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryImageUpdate; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class GalleryImageImpl implements GalleryImage, GalleryImage.Definition, GalleryImage.Update { + private GalleryImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String description() { + return this.innerModel().description(); + } + + public String eula() { + return this.innerModel().eula(); + } + + public String privacyStatementUri() { + return this.innerModel().privacyStatementUri(); + } + + public String releaseNoteUri() { + return this.innerModel().releaseNoteUri(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public OperatingSystemStateTypes osState() { + return this.innerModel().osState(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public GalleryImageIdentifier identifier() { + return this.innerModel().identifier(); + } + + public RecommendedMachineConfiguration recommended() { + return this.innerModel().recommended(); + } + + public Disallowed disallowed() { + return this.innerModel().disallowed(); + } + + public ImagePurchasePlan purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public GalleryImagePropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List features() { + List inner = this.innerModel().features(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryName; + + private String galleryImageName; + + private GalleryImageUpdate updateGalleryImage; + + public GalleryImageImpl withExistingGallery(String resourceGroupName, String galleryName) { + this.resourceGroupName = resourceGroupName; + this.galleryName = galleryName; + return this; + } + + public GalleryImage create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .createOrUpdate(resourceGroupName, galleryName, galleryImageName, this.innerModel(), Context.NONE); + return this; + } + + public GalleryImage create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .createOrUpdate(resourceGroupName, galleryName, galleryImageName, this.innerModel(), context); + return this; + } + + GalleryImageImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new GalleryImageInner(); + this.serviceManager = serviceManager; + this.galleryImageName = name; + } + + public GalleryImageImpl update() { + this.updateGalleryImage = new GalleryImageUpdate(); + return this; + } + + public GalleryImage apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .update(resourceGroupName, galleryName, galleryImageName, updateGalleryImage, Context.NONE); + return this; + } + + public GalleryImage apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .update(resourceGroupName, galleryName, galleryImageName, updateGalleryImage, context); + return this; + } + + GalleryImageImpl( + GalleryImageInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + this.galleryImageName = Utils.getValueFromIdByName(innerObject.id(), "images"); + } + + public GalleryImage refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .getWithResponse(resourceGroupName, galleryName, galleryImageName, Context.NONE) + .getValue(); + return this; + } + + public GalleryImage refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImages() + .getWithResponse(resourceGroupName, galleryName, 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.updateGalleryImage.withTags(tags); + return this; + } + } + + public GalleryImageImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateGalleryImage.withDescription(description); + return this; + } + } + + public GalleryImageImpl withEula(String eula) { + if (isInCreateMode()) { + this.innerModel().withEula(eula); + return this; + } else { + this.updateGalleryImage.withEula(eula); + return this; + } + } + + public GalleryImageImpl withPrivacyStatementUri(String privacyStatementUri) { + if (isInCreateMode()) { + this.innerModel().withPrivacyStatementUri(privacyStatementUri); + return this; + } else { + this.updateGalleryImage.withPrivacyStatementUri(privacyStatementUri); + return this; + } + } + + public GalleryImageImpl withReleaseNoteUri(String releaseNoteUri) { + if (isInCreateMode()) { + this.innerModel().withReleaseNoteUri(releaseNoteUri); + return this; + } else { + this.updateGalleryImage.withReleaseNoteUri(releaseNoteUri); + return this; + } + } + + public GalleryImageImpl withOsType(OperatingSystemTypes osType) { + if (isInCreateMode()) { + this.innerModel().withOsType(osType); + return this; + } else { + this.updateGalleryImage.withOsType(osType); + return this; + } + } + + public GalleryImageImpl withOsState(OperatingSystemStateTypes osState) { + if (isInCreateMode()) { + this.innerModel().withOsState(osState); + return this; + } else { + this.updateGalleryImage.withOsState(osState); + return this; + } + } + + public GalleryImageImpl withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (isInCreateMode()) { + this.innerModel().withHyperVGeneration(hyperVGeneration); + return this; + } else { + this.updateGalleryImage.withHyperVGeneration(hyperVGeneration); + return this; + } + } + + public GalleryImageImpl withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (isInCreateMode()) { + this.innerModel().withEndOfLifeDate(endOfLifeDate); + return this; + } else { + this.updateGalleryImage.withEndOfLifeDate(endOfLifeDate); + return this; + } + } + + public GalleryImageImpl withIdentifier(GalleryImageIdentifier identifier) { + if (isInCreateMode()) { + this.innerModel().withIdentifier(identifier); + return this; + } else { + this.updateGalleryImage.withIdentifier(identifier); + return this; + } + } + + public GalleryImageImpl withRecommended(RecommendedMachineConfiguration recommended) { + if (isInCreateMode()) { + this.innerModel().withRecommended(recommended); + return this; + } else { + this.updateGalleryImage.withRecommended(recommended); + return this; + } + } + + public GalleryImageImpl withDisallowed(Disallowed disallowed) { + if (isInCreateMode()) { + this.innerModel().withDisallowed(disallowed); + return this; + } else { + this.updateGalleryImage.withDisallowed(disallowed); + return this; + } + } + + public GalleryImageImpl withPurchasePlan(ImagePurchasePlan purchasePlan) { + if (isInCreateMode()) { + this.innerModel().withPurchasePlan(purchasePlan); + return this; + } else { + this.updateGalleryImage.withPurchasePlan(purchasePlan); + return this; + } + } + + public GalleryImageImpl withFeatures(List features) { + if (isInCreateMode()) { + this.innerModel().withFeatures(features); + return this; + } else { + this.updateGalleryImage.withFeatures(features); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionImpl.java new file mode 100644 index 0000000000000..c5bc11dcd7340 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionImpl.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatus; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import java.util.Collections; +import java.util.Map; + +public final class GalleryImageVersionImpl + implements GalleryImageVersion, GalleryImageVersion.Definition, GalleryImageVersion.Update { + private GalleryImageVersionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 GalleryImageVersionPublishingProfile publishingProfile() { + return this.innerModel().publishingProfile(); + } + + public GalleryImageVersionPropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public GalleryImageVersionStorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public ReplicationStatus replicationStatus() { + return this.innerModel().replicationStatus(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GalleryImageVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryName; + + private String galleryImageName; + + private String galleryImageVersionName; + + private GalleryImageVersionUpdate updateGalleryImageVersion; + + public GalleryImageVersionImpl withExistingImage( + String resourceGroupName, String galleryName, String galleryImageName) { + this.resourceGroupName = resourceGroupName; + this.galleryName = galleryName; + this.galleryImageName = galleryImageName; + return this; + } + + public GalleryImageVersion create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + this.innerModel(), + Context.NONE); + return this; + } + + public GalleryImageVersion create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + this.innerModel(), + context); + return this; + } + + GalleryImageVersionImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new GalleryImageVersionInner(); + this.serviceManager = serviceManager; + this.galleryImageVersionName = name; + } + + public GalleryImageVersionImpl update() { + this.updateGalleryImageVersion = new GalleryImageVersionUpdate(); + return this; + } + + public GalleryImageVersion apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .update( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + updateGalleryImageVersion, + Context.NONE); + return this; + } + + public GalleryImageVersion apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .update( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + updateGalleryImageVersion, + context); + return this; + } + + GalleryImageVersionImpl( + GalleryImageVersionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + this.galleryImageName = Utils.getValueFromIdByName(innerObject.id(), "images"); + this.galleryImageVersionName = Utils.getValueFromIdByName(innerObject.id(), "versions"); + } + + public GalleryImageVersion refresh() { + ReplicationStatusTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .getWithResponse( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + localExpand, + Context.NONE) + .getValue(); + return this; + } + + public GalleryImageVersion refresh(Context context) { + ReplicationStatusTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleryImageVersions() + .getWithResponse( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, localExpand, context) + .getValue(); + return this; + } + + public GalleryImageVersionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GalleryImageVersionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GalleryImageVersionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateGalleryImageVersion.withTags(tags); + return this; + } + } + + public GalleryImageVersionImpl withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile) { + if (isInCreateMode()) { + this.innerModel().withPublishingProfile(publishingProfile); + return this; + } else { + this.updateGalleryImageVersion.withPublishingProfile(publishingProfile); + return this; + } + } + + public GalleryImageVersionImpl withStorageProfile(GalleryImageVersionStorageProfile storageProfile) { + if (isInCreateMode()) { + this.innerModel().withStorageProfile(storageProfile); + return this; + } else { + this.updateGalleryImageVersion.withStorageProfile(storageProfile); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsClientImpl.java new file mode 100644 index 0000000000000..a2a9820f67565 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsClientImpl.java @@ -0,0 +1,1816 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.GalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionList; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionUpdate; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +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 GalleryImageVersionsClient. */ +public final class GalleryImageVersionsClientImpl implements GalleryImageVersionsClient { + private final ClientLogger logger = new ClientLogger(GalleryImageVersionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleryImageVersionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GalleryImageVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryImageVersionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(GalleryImageVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGalleryImageVersions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GalleryImageVersionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryImageVersionInner galleryImageVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryImageVersionUpdate galleryImageVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @QueryParam("$expand") ReplicationStatusTypes expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryImage( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryImageNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + if (galleryImageVersion == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageVersion is required and cannot be null.")); + } else { + galleryImageVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + galleryImageVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + if (galleryImageVersion == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageVersion is required and cannot be null.")); + } else { + galleryImageVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + galleryImageVersion, + accept, + context); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageVersionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageVersionInner.class, + GalleryImageVersionInner.class, + this.client.getContext()); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageVersionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + galleryImageVersion, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageVersionInner.class, + GalleryImageVersionInner.class, + context); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .getSyncPoller(); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageVersionInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .getSyncPoller(); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion) { + return createOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .block(); + } + + /** + * Create or update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be created. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the create or update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageVersionInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionInner galleryImageVersion, + Context context) { + return createOrUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .block(); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + if (galleryImageVersion == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageVersion is required and cannot be null.")); + } else { + galleryImageVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + galleryImageVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + if (galleryImageVersion == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageVersion is required and cannot be null.")); + } else { + galleryImageVersion.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + galleryImageVersion, + accept, + context); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageVersionInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageVersionInner.class, + GalleryImageVersionInner.class, + this.client.getContext()); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageVersionInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + galleryImageVersion, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageVersionInner.class, + GalleryImageVersionInner.class, + context); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion) { + return beginUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .getSyncPoller(); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageVersionInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context) { + return beginUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .getSyncPoller(); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion) { + return beginUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context) { + return beginUpdateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageVersionInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion) { + return updateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion) + .block(); + } + + /** + * Update a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be updated. + * @param galleryImageVersionName The name of the gallery image version to be updated. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param galleryImageVersion Parameters supplied to the update gallery image version operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageVersionInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + GalleryImageVersionUpdate galleryImageVersion, + Context context) { + return updateAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, context) + .block(); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + expand, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + expand, + apiVersion, + accept, + context); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand) { + return getWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + final ReplicationStatusTypes expand = null; + return getWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageVersionInner get( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + final ReplicationStatusTypes expand = null; + return getAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand).block(); + } + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand, + Context context) { + return getWithResponseAsync( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand, context) + .block(); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, String galleryImageName, String galleryImageVersionName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + galleryImageVersionName, + apiVersion, + accept, + context); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName) + .getSyncPoller(); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context) + .getSyncPoller(); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName, String galleryImageVersionName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName, String galleryImageVersionName) { + deleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).block(); + } + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + deleteAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context).block(); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryImageSinglePageAsync( + String resourceGroupName, String galleryName, 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByGalleryImage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryImageSinglePageAsync( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryImage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryImageAsync( + String resourceGroupName, String galleryName, String galleryImageName) { + return new PagedFlux<>( + () -> listByGalleryImageSinglePageAsync(resourceGroupName, galleryName, galleryImageName), + nextLink -> listByGalleryImageNextSinglePageAsync(nextLink)); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryImageAsync( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + return new PagedFlux<>( + () -> listByGalleryImageSinglePageAsync(resourceGroupName, galleryName, galleryImageName, context), + nextLink -> listByGalleryImageNextSinglePageAsync(nextLink, context)); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName) { + return new PagedIterable<>(listByGalleryImageAsync(resourceGroupName, galleryName, galleryImageName)); + } + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + return new PagedIterable<>(listByGalleryImageAsync(resourceGroupName, galleryName, galleryImageName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryImageNextSinglePageAsync(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.listByGalleryImageNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryImageNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryImageNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsImpl.java new file mode 100644 index 0000000000000..448b84a83bf7f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImageVersionsImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.GalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersions; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleryImageVersionsImpl implements GalleryImageVersions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionsImpl.class); + + private final GalleryImageVersionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GalleryImageVersionsImpl( + GalleryImageVersionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GalleryImageVersion get( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + GalleryImageVersionInner inner = + this.serviceClient().get(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName); + if (inner != null) { + return new GalleryImageVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryImageVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName); + } + + public void delete( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context); + } + + public PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName) { + PagedIterable inner = + this.serviceClient().listByGalleryImage(resourceGroupName, galleryName, galleryImageName); + return Utils.mapPage(inner, inner1 -> new GalleryImageVersionImpl(inner1, this.manager())); + } + + public PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + PagedIterable inner = + this.serviceClient().listByGalleryImage(resourceGroupName, galleryName, galleryImageName, context); + return Utils.mapPage(inner, inner1 -> new GalleryImageVersionImpl(inner1, this.manager())); + } + + public GalleryImageVersion getById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + String galleryImageVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryImageVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + ReplicationStatusTypes localExpand = null; + return this + .getWithResponse( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, ReplicationStatusTypes expand, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + String galleryImageVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryImageVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this + .getWithResponse( + resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + String galleryImageVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryImageVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + String galleryImageVersionName = Utils.getValueFromIdByName(id, "versions"); + if (galleryImageVersionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, context); + } + + private GalleryImageVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public GalleryImageVersionImpl define(String name) { + return new GalleryImageVersionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesClientImpl.java new file mode 100644 index 0000000000000..500749dd52b38 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesClientImpl.java @@ -0,0 +1,1523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.GalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.GalleryImageList; +import com.azure.resourcemanager.compute.generated.models.GalleryImageUpdate; +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 { + private final ClientLogger logger = new ClientLogger(GalleryImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleryImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryImagesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(GalleryImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGalleryImages to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GalleryImagesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryImageInner galleryImage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GalleryImageUpdate galleryImage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images/{galleryImageName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGallery( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByGalleryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImage == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryImage is required and cannot be null.")); + } else { + galleryImage.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + galleryImage, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImage == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryImage is required and cannot be null.")); + } else { + galleryImage.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + galleryImage, + accept, + context); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImage); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageInner.class, + GalleryImageInner.class, + this.client.getContext()); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryImageInner.class, GalleryImageInner.class, context); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).getSyncPoller(); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context) + .getSyncPoller(); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner createOrUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageInner galleryImage) { + return createOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).block(); + } + + /** + * Create or update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @param galleryImageName The name of the gallery image definition to be created or updated. The allowed characters + * are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the create or update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner createOrUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageInner galleryImage, + Context context) { + return createOrUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context).block(); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImage == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryImage is required and cannot be null.")); + } else { + galleryImage.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + galleryImage, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImage == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryImage is required and cannot be null.")); + } else { + galleryImage.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + galleryImage, + accept, + context); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> beginUpdateAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImage); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GalleryImageInner.class, + GalleryImageInner.class, + this.client.getContext()); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> beginUpdateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GalleryImageInner.class, GalleryImageInner.class, context); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginUpdate( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).getSyncPoller(); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginUpdate( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context) + .getSyncPoller(); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner update( + String resourceGroupName, String galleryName, String galleryImageName, GalleryImageUpdate galleryImage) { + return updateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage).block(); + } + + /** + * Update a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be updated. + * @param galleryImageName The name of the gallery image definition to be updated. The allowed characters are + * alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 + * characters. + * @param galleryImage Parameters supplied to the update gallery image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner update( + String resourceGroupName, + String galleryName, + String galleryImageName, + GalleryImageUpdate galleryImage, + Context context) { + return updateAsync(resourceGroupName, galleryName, galleryImageName, galleryImage, context).block(); + } + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String galleryName, 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context); + } + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String galleryName, String galleryImageName) { + return getWithResponseAsync(resourceGroupName, galleryName, galleryImageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner get(String resourceGroupName, String galleryName, String galleryImageName) { + return getAsync(resourceGroupName, galleryName, galleryImageName).block(); + } + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + return getWithResponseAsync(resourceGroupName, galleryName, galleryImageName, context).block(); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 galleryName, String galleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + galleryImageName, + apiVersion, + accept, + context); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, String galleryImageName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryImageName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, galleryName, galleryImageName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName).getSyncPoller(); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, context).getSyncPoller(); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName, Context context) { + return beginDeleteAsync(resourceGroupName, galleryName, galleryImageName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName) { + deleteAsync(resourceGroupName, galleryName, galleryImageName).block(); + } + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 galleryName, String galleryImageName, Context context) { + deleteAsync(resourceGroupName, galleryName, galleryImageName, context).block(); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String galleryName) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByGallery( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGallerySinglePageAsync( + String resourceGroupName, String galleryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGallery( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync(String resourceGroupName, String galleryName) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, galleryName), + nextLink -> listByGalleryNextSinglePageAsync(nextLink)); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByGalleryAsync( + String resourceGroupName, String galleryName, Context context) { + return new PagedFlux<>( + () -> listByGallerySinglePageAsync(resourceGroupName, galleryName, context), + nextLink -> listByGalleryNextSinglePageAsync(nextLink, context)); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery(String resourceGroupName, String galleryName) { + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName)); + } + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByGallery( + String resourceGroupName, String galleryName, Context context) { + return new PagedIterable<>(listByGalleryAsync(resourceGroupName, galleryName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync(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.listByGalleryNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByGalleryNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByGalleryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesImpl.java new file mode 100644 index 0000000000000..4906bb11b30ab --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImagesImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.GalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.GalleryImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleryImagesImpl implements GalleryImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImagesImpl.class); + + private final GalleryImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GalleryImagesImpl( + GalleryImagesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GalleryImage get(String resourceGroupName, String galleryName, String galleryImageName) { + GalleryImageInner inner = this.serviceClient().get(resourceGroupName, galleryName, galleryImageName); + if (inner != null) { + return new GalleryImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String galleryName, String galleryImageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, galleryName, galleryImageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GalleryImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String galleryName, String galleryImageName) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryImageName); + } + + public void delete(String resourceGroupName, String galleryName, String galleryImageName, Context context) { + this.serviceClient().delete(resourceGroupName, galleryName, galleryImageName, context); + } + + public PagedIterable listByGallery(String resourceGroupName, String galleryName) { + PagedIterable inner = this.serviceClient().listByGallery(resourceGroupName, galleryName); + return Utils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable listByGallery(String resourceGroupName, String galleryName, Context context) { + PagedIterable inner = + this.serviceClient().listByGallery(resourceGroupName, galleryName, context); + return Utils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public GalleryImage getById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + return this.getWithResponse(resourceGroupName, galleryName, galleryImageName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + return this.getWithResponse(resourceGroupName, galleryName, galleryImageName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryImageName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 galleryName = Utils.getValueFromIdByName(id, "galleries"); + if (galleryName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleries'.", id))); + } + String galleryImageName = Utils.getValueFromIdByName(id, "images"); + if (galleryImageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, galleryName, galleryImageName, context); + } + + private GalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public GalleryImageImpl define(String name) { + return new GalleryImageImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImpl.java new file mode 100644 index 0000000000000..875886070a67a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GalleryImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner; +import com.azure.resourcemanager.compute.generated.models.Gallery; +import com.azure.resourcemanager.compute.generated.models.GalleryIdentifier; +import com.azure.resourcemanager.compute.generated.models.GalleryPropertiesProvisioningState; +import com.azure.resourcemanager.compute.generated.models.GalleryUpdate; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; +import com.azure.resourcemanager.compute.generated.models.SharingProfile; +import com.azure.resourcemanager.compute.generated.models.SoftDeletePolicy; +import java.util.Collections; +import java.util.Map; + +public final class GalleryImpl implements Gallery, Gallery.Definition, Gallery.Update { + private GalleryInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String description() { + return this.innerModel().description(); + } + + public GalleryIdentifier identifier() { + return this.innerModel().identifier(); + } + + public GalleryPropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public SharingProfile sharingProfile() { + return this.innerModel().sharingProfile(); + } + + public SoftDeletePolicy softDeletePolicy() { + return this.innerModel().softDeletePolicy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GalleryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryName; + + private GalleryUpdate updateGallery; + + public GalleryImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Gallery create() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, galleryName, this.innerModel(), Context.NONE); + return this; + } + + public Gallery create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .createOrUpdate(resourceGroupName, galleryName, this.innerModel(), context); + return this; + } + + GalleryImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new GalleryInner(); + this.serviceManager = serviceManager; + this.galleryName = name; + } + + public GalleryImpl update() { + this.updateGallery = new GalleryUpdate(); + return this; + } + + public Gallery apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .update(resourceGroupName, galleryName, updateGallery, Context.NONE); + return this; + } + + public Gallery apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .update(resourceGroupName, galleryName, updateGallery, context); + return this; + } + + GalleryImpl(GalleryInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryName = Utils.getValueFromIdByName(innerObject.id(), "galleries"); + } + + public Gallery refresh() { + SelectPermissions localSelect = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .getByResourceGroupWithResponse(resourceGroupName, galleryName, localSelect, Context.NONE) + .getValue(); + return this; + } + + public Gallery refresh(Context context) { + SelectPermissions localSelect = null; + this.innerObject = + serviceManager + .serviceClient() + .getGalleries() + .getByResourceGroupWithResponse(resourceGroupName, galleryName, localSelect, context) + .getValue(); + return this; + } + + public GalleryImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GalleryImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GalleryImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateGallery.withTags(tags); + return this; + } + } + + public GalleryImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateGallery.withDescription(description); + return this; + } + } + + public GalleryImpl withIdentifier(GalleryIdentifier identifier) { + if (isInCreateMode()) { + this.innerModel().withIdentifier(identifier); + return this; + } else { + this.updateGallery.withIdentifier(identifier); + return this; + } + } + + public GalleryImpl withSharingProfile(SharingProfile sharingProfile) { + if (isInCreateMode()) { + this.innerModel().withSharingProfile(sharingProfile); + return this; + } else { + this.updateGallery.withSharingProfile(sharingProfile); + return this; + } + } + + public GalleryImpl withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy) { + if (isInCreateMode()) { + this.innerModel().withSoftDeletePolicy(softDeletePolicy); + return this; + } else { + this.updateGallery.withSoftDeletePolicy(softDeletePolicy); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesClientImpl.java new file mode 100644 index 0000000000000..bff6445a48055 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesClientImpl.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.polling.PollResult; +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.compute.generated.fluent.GallerySharingProfilesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +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 GallerySharingProfilesClient. */ +public final class GallerySharingProfilesClientImpl implements GallerySharingProfilesClient { + private final ClientLogger logger = new ClientLogger(GallerySharingProfilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GallerySharingProfilesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of GallerySharingProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GallerySharingProfilesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(GallerySharingProfilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientGallerySharingProfiles to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface GallerySharingProfilesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + + "/{galleryName}/share") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryName") String galleryName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SharingUpdateInner sharingUpdate, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + 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 (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (sharingUpdate == null) { + return Mono.error(new IllegalArgumentException("Parameter sharingUpdate is required and cannot be null.")); + } else { + sharingUpdate.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + sharingUpdate, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryName == null) { + return Mono.error(new IllegalArgumentException("Parameter galleryName is required and cannot be null.")); + } + if (sharingUpdate == null) { + return Mono.error(new IllegalArgumentException("Parameter sharingUpdate is required and cannot be null.")); + } else { + sharingUpdate.validate(); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + galleryName, + apiVersion, + sharingUpdate, + accept, + context); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SharingUpdateInner> beginUpdateAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, galleryName, sharingUpdate); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SharingUpdateInner.class, + SharingUpdateInner.class, + this.client.getContext()); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SharingUpdateInner> beginUpdateAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, galleryName, sharingUpdate, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SharingUpdateInner.class, SharingUpdateInner.class, context); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SharingUpdateInner> beginUpdate( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + return beginUpdateAsync(resourceGroupName, galleryName, sharingUpdate).getSyncPoller(); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SharingUpdateInner> beginUpdate( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, sharingUpdate, context).getSyncPoller(); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + return beginUpdateAsync(resourceGroupName, galleryName, sharingUpdate) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + return beginUpdateAsync(resourceGroupName, galleryName, sharingUpdate, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharingUpdateInner update(String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + return updateAsync(resourceGroupName, galleryName, sharingUpdate).block(); + } + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharingUpdateInner update( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + return updateAsync(resourceGroupName, galleryName, sharingUpdate, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesImpl.java new file mode 100644 index 0000000000000..125fdc121add6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/GallerySharingProfilesImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.GallerySharingProfilesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.generated.models.GallerySharingProfiles; +import com.azure.resourcemanager.compute.generated.models.SharingUpdate; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GallerySharingProfilesImpl implements GallerySharingProfiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GallerySharingProfilesImpl.class); + + private final GallerySharingProfilesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public GallerySharingProfilesImpl( + GallerySharingProfilesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SharingUpdate update(String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate) { + SharingUpdateInner inner = this.serviceClient().update(resourceGroupName, galleryName, sharingUpdate); + if (inner != null) { + return new SharingUpdateImpl(inner, this.manager()); + } else { + return null; + } + } + + public SharingUpdate update( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context) { + SharingUpdateInner inner = this.serviceClient().update(resourceGroupName, galleryName, sharingUpdate, context); + if (inner != null) { + return new SharingUpdateImpl(inner, this.manager()); + } else { + return null; + } + } + + private GallerySharingProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImageImpl.java new file mode 100644 index 0000000000000..f598c2c82fc88 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImageImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageInner; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.Image; +import com.azure.resourcemanager.compute.generated.models.ImageStorageProfile; +import com.azure.resourcemanager.compute.generated.models.ImageUpdate; +import java.util.Collections; +import java.util.Map; + +public final class ImageImpl implements Image, Image.Definition, Image.Update { + private ImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SubResource sourceVirtualMachine() { + return this.innerModel().sourceVirtualMachine(); + } + + public ImageStorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public HyperVGenerationTypes hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String imageName; + + private ImageUpdate updateParameters; + + public ImageImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Image create() { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, imageName, this.innerModel(), Context.NONE); + return this; + } + + public Image create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, imageName, this.innerModel(), context); + return this; + } + + ImageImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new ImageInner(); + this.serviceManager = serviceManager; + this.imageName = name; + } + + public ImageImpl update() { + this.updateParameters = new ImageUpdate(); + return this; + } + + public Image apply() { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .update(resourceGroupName, imageName, updateParameters, Context.NONE); + return this; + } + + public Image apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getImages().update(resourceGroupName, imageName, updateParameters, context); + return this; + } + + ImageImpl(ImageInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.imageName = Utils.getValueFromIdByName(innerObject.id(), "images"); + } + + public Image refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .getByResourceGroupWithResponse(resourceGroupName, imageName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Image refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .getByResourceGroupWithResponse(resourceGroupName, imageName, localExpand, context) + .getValue(); + return this; + } + + public ImageImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ImageImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ImageImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ImageImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public ImageImpl withSourceVirtualMachine(SubResource sourceVirtualMachine) { + if (isInCreateMode()) { + this.innerModel().withSourceVirtualMachine(sourceVirtualMachine); + return this; + } else { + this.updateParameters.withSourceVirtualMachine(sourceVirtualMachine); + return this; + } + } + + public ImageImpl withStorageProfile(ImageStorageProfile storageProfile) { + if (isInCreateMode()) { + this.innerModel().withStorageProfile(storageProfile); + return this; + } else { + this.updateParameters.withStorageProfile(storageProfile); + return this; + } + } + + public ImageImpl withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + if (isInCreateMode()) { + this.innerModel().withHyperVGeneration(hyperVGeneration); + return this; + } else { + this.updateParameters.withHyperVGeneration(hyperVGeneration); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesClientImpl.java new file mode 100644 index 0000000000000..d7771181b81eb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesClientImpl.java @@ -0,0 +1,1577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.ImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.ImageListResult; +import com.azure.resourcemanager.compute.generated.models.ImageUpdate; +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 ImagesClient. */ +public final class ImagesClientImpl implements ImagesClient { + private final ClientLogger logger = new ClientLogger(ImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of ImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImagesClientImpl(ComputeManagementClientImpl client) { + this.service = RestProxy.create(ImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientImages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface ImagesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + + "/{imageName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageName") String imageName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ImageInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + + "/{imageName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageName") String imageName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ImageUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + + "/{imageName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageName") String imageName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + + "/{imageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageName") String imageName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @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.Compute/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String imageName, ImageInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String imageName, ImageInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String imageName, ImageInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, imageName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, this.client.getContext()); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String imageName, ImageInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, imageName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, context); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String imageName, ImageInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, imageName, parameters).getSyncPoller(); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String imageName, ImageInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, imageName, parameters, context).getSyncPoller(); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String imageName, ImageInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, imageName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String imageName, ImageInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, imageName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner createOrUpdate(String resourceGroupName, String imageName, ImageInner parameters) { + return createOrUpdateAsync(resourceGroupName, imageName, parameters).block(); + } + + /** + * Create or update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Create Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner createOrUpdate( + String resourceGroupName, String imageName, ImageInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, imageName, parameters, context).block(); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String imageName, ImageUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String imageName, ImageUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginUpdateAsync( + String resourceGroupName, String imageName, ImageUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, imageName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, this.client.getContext()); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginUpdateAsync( + String resourceGroupName, String imageName, ImageUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, imageName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, context); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginUpdate( + String resourceGroupName, String imageName, ImageUpdate parameters) { + return beginUpdateAsync(resourceGroupName, imageName, parameters).getSyncPoller(); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginUpdate( + String resourceGroupName, String imageName, ImageUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, imageName, parameters, context).getSyncPoller(); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String imageName, ImageUpdate parameters) { + return beginUpdateAsync(resourceGroupName, imageName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String imageName, ImageUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, imageName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner update(String resourceGroupName, String imageName, ImageUpdate parameters) { + return updateAsync(resourceGroupName, imageName, parameters).block(); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the source user image virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner update(String resourceGroupName, String imageName, ImageUpdate parameters, Context context) { + return updateAsync(resourceGroupName, imageName, parameters, context).block(); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 imageName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 imageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + imageName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String imageName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, imageName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String imageName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, imageName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String imageName) { + return beginDeleteAsync(resourceGroupName, imageName).getSyncPoller(); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String imageName, Context context) { + return beginDeleteAsync(resourceGroupName, imageName, context).getSyncPoller(); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 imageName) { + return beginDeleteAsync(resourceGroupName, imageName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 imageName, Context context) { + return beginDeleteAsync(resourceGroupName, imageName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 imageName) { + deleteAsync(resourceGroupName, imageName).block(); + } + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 imageName, Context context) { + deleteAsync(resourceGroupName, imageName, context).block(); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String imageName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + imageName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String imageName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + imageName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String imageName, String expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, imageName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String imageName) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, imageName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner getByResourceGroup(String resourceGroupName, String imageName) { + final String expand = null; + return getByResourceGroupAsync(resourceGroupName, imageName, expand).block(); + } + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String imageName, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, imageName, expand, context).block(); + } + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Image operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Image operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Image operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Image operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesImpl.java new file mode 100644 index 0000000000000..d33de68a99534 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ImagesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.ImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageInner; +import com.azure.resourcemanager.compute.generated.models.Image; +import com.azure.resourcemanager.compute.generated.models.Images; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ImagesImpl implements Images { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImagesImpl.class); + + private final ImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public ImagesImpl( + ImagesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String imageName) { + this.serviceClient().delete(resourceGroupName, imageName); + } + + public void delete(String resourceGroupName, String imageName, Context context) { + this.serviceClient().delete(resourceGroupName, imageName, context); + } + + public Image getByResourceGroup(String resourceGroupName, String imageName) { + ImageInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, imageName); + if (inner != null) { + return new ImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String imageName, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, imageName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public Image getById(String id) { + String resourceGroupName = Utils.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 imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + String localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, imageName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.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 imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, imageName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, imageName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, imageName, context); + } + + private ImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public ImageImpl define(String name) { + return new ImageImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsClientImpl.java new file mode 100644 index 0000000000000..d181219e7f8b9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsClientImpl.java @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.polling.PollResult; +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.compute.generated.fluent.LogAnalyticsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.LogAnalyticsOperationResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.RequestRateByIntervalInput; +import com.azure.resourcemanager.compute.generated.models.ThrottledRequestsInput; +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 LogAnalyticsClient. */ +public final class LogAnalyticsClientImpl implements LogAnalyticsClient { + private final ClientLogger logger = new ClientLogger(LogAnalyticsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LogAnalyticsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of LogAnalyticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogAnalyticsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(LogAnalyticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientLogAnalytics to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface LogAnalyticsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess" + + "/getRequestRateByInterval") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> exportRequestRateByInterval( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RequestRateByIntervalInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess" + + "/getThrottledRequests") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> exportThrottledRequests( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ThrottledRequestsInput parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportRequestRateByIntervalWithResponseAsync( + String location, RequestRateByIntervalInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportRequestRateByInterval( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportRequestRateByIntervalWithResponseAsync( + String location, RequestRateByIntervalInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportRequestRateByInterval( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogAnalyticsOperationResultInner> + beginExportRequestRateByIntervalAsync(String location, RequestRateByIntervalInput parameters) { + Mono>> mono = exportRequestRateByIntervalWithResponseAsync(location, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogAnalyticsOperationResultInner.class, + LogAnalyticsOperationResultInner.class, + this.client.getContext()); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogAnalyticsOperationResultInner> + beginExportRequestRateByIntervalAsync(String location, RequestRateByIntervalInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + exportRequestRateByIntervalWithResponseAsync(location, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogAnalyticsOperationResultInner.class, + LogAnalyticsOperationResultInner.class, + context); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogAnalyticsOperationResultInner> + beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters) { + return beginExportRequestRateByIntervalAsync(location, parameters).getSyncPoller(); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogAnalyticsOperationResultInner> + beginExportRequestRateByInterval(String location, RequestRateByIntervalInput parameters, Context context) { + return beginExportRequestRateByIntervalAsync(location, parameters, context).getSyncPoller(); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportRequestRateByIntervalAsync( + String location, RequestRateByIntervalInput parameters) { + return beginExportRequestRateByIntervalAsync(location, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportRequestRateByIntervalAsync( + String location, RequestRateByIntervalInput parameters, Context context) { + return beginExportRequestRateByIntervalAsync(location, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogAnalyticsOperationResultInner exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters) { + return exportRequestRateByIntervalAsync(location, parameters).block(); + } + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogAnalyticsOperationResultInner exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters, Context context) { + return exportRequestRateByIntervalAsync(location, parameters, context).block(); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportThrottledRequestsWithResponseAsync( + String location, ThrottledRequestsInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportThrottledRequests( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportThrottledRequestsWithResponseAsync( + String location, ThrottledRequestsInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportThrottledRequests( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogAnalyticsOperationResultInner> + beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters) { + Mono>> mono = exportThrottledRequestsWithResponseAsync(location, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogAnalyticsOperationResultInner.class, + LogAnalyticsOperationResultInner.class, + this.client.getContext()); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogAnalyticsOperationResultInner> + beginExportThrottledRequestsAsync(String location, ThrottledRequestsInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = exportThrottledRequestsWithResponseAsync(location, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogAnalyticsOperationResultInner.class, + LogAnalyticsOperationResultInner.class, + context); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogAnalyticsOperationResultInner> + beginExportThrottledRequests(String location, ThrottledRequestsInput parameters) { + return beginExportThrottledRequestsAsync(location, parameters).getSyncPoller(); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogAnalyticsOperationResultInner> + beginExportThrottledRequests(String location, ThrottledRequestsInput parameters, Context context) { + return beginExportThrottledRequestsAsync(location, parameters, context).getSyncPoller(); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportThrottledRequestsAsync( + String location, ThrottledRequestsInput parameters) { + return beginExportThrottledRequestsAsync(location, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportThrottledRequestsAsync( + String location, ThrottledRequestsInput parameters, Context context) { + return beginExportThrottledRequestsAsync(location, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogAnalyticsOperationResultInner exportThrottledRequests( + String location, ThrottledRequestsInput parameters) { + return exportThrottledRequestsAsync(location, parameters).block(); + } + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogAnalyticsOperationResultInner exportThrottledRequests( + String location, ThrottledRequestsInput parameters, Context context) { + return exportThrottledRequestsAsync(location, parameters, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsImpl.java new file mode 100644 index 0000000000000..07c0dc9333bd9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.LogAnalyticsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.LogAnalyticsOperationResultInner; +import com.azure.resourcemanager.compute.generated.models.LogAnalytics; +import com.azure.resourcemanager.compute.generated.models.LogAnalyticsOperationResult; +import com.azure.resourcemanager.compute.generated.models.RequestRateByIntervalInput; +import com.azure.resourcemanager.compute.generated.models.ThrottledRequestsInput; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LogAnalyticsImpl implements LogAnalytics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsImpl.class); + + private final LogAnalyticsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public LogAnalyticsImpl( + LogAnalyticsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LogAnalyticsOperationResult exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters) { + LogAnalyticsOperationResultInner inner = this.serviceClient().exportRequestRateByInterval(location, parameters); + if (inner != null) { + return new LogAnalyticsOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogAnalyticsOperationResult exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters, Context context) { + LogAnalyticsOperationResultInner inner = + this.serviceClient().exportRequestRateByInterval(location, parameters, context); + if (inner != null) { + return new LogAnalyticsOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogAnalyticsOperationResult exportThrottledRequests(String location, ThrottledRequestsInput parameters) { + LogAnalyticsOperationResultInner inner = this.serviceClient().exportThrottledRequests(location, parameters); + if (inner != null) { + return new LogAnalyticsOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogAnalyticsOperationResult exportThrottledRequests( + String location, ThrottledRequestsInput parameters, Context context) { + LogAnalyticsOperationResultInner inner = + this.serviceClient().exportThrottledRequests(location, parameters, context); + if (inner != null) { + return new LogAnalyticsOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private LogAnalyticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsOperationResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsOperationResultImpl.java new file mode 100644 index 0000000000000..498f33b546b23 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/LogAnalyticsOperationResultImpl.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.LogAnalyticsOperationResultInner; +import com.azure.resourcemanager.compute.generated.models.LogAnalyticsOperationResult; +import com.azure.resourcemanager.compute.generated.models.LogAnalyticsOutput; + +public final class LogAnalyticsOperationResultImpl implements LogAnalyticsOperationResult { + private LogAnalyticsOperationResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + LogAnalyticsOperationResultImpl( + LogAnalyticsOperationResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LogAnalyticsOutput properties() { + return this.innerModel().properties(); + } + + public LogAnalyticsOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSFamilyImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSFamilyImpl.java new file mode 100644 index 0000000000000..f8f51ec56a409 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSFamilyImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner; +import com.azure.resourcemanager.compute.generated.models.OSFamily; +import com.azure.resourcemanager.compute.generated.models.OSFamilyProperties; + +public final class OSFamilyImpl implements OSFamily { + private OSFamilyInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + OSFamilyImpl(OSFamilyInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 String location() { + return this.innerModel().location(); + } + + public OSFamilyProperties properties() { + return this.innerModel().properties(); + } + + public OSFamilyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSVersionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSVersionImpl.java new file mode 100644 index 0000000000000..fc67b7d79dfb2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OSVersionImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; +import com.azure.resourcemanager.compute.generated.models.OSVersion; +import com.azure.resourcemanager.compute.generated.models.OSVersionProperties; + +public final class OSVersionImpl implements OSVersion { + private OSVersionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + OSVersionImpl( + OSVersionInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 String location() { + return this.innerModel().location(); + } + + public OSVersionProperties properties() { + return this.innerModel().properties(); + } + + public OSVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..e2e0fcbc0350f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.OperationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.ComputeOperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Compute/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of compute operations. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of compute operations. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets a list of compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Gets a list of compute operations. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..af12838fe6832 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.OperationsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; +import com.azure.resourcemanager.compute.generated.models.ComputeOperationValue; +import com.azure.resourcemanager.compute.generated.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ComputeOperationValueImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ComputeOperationValueImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..9cd7d390e9898 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkServiceConnectionState; + +public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager 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 PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateLinkResourceListResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateLinkResourceListResultImpl.java new file mode 100644 index 0000000000000..bafdba6162ccd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/PrivateLinkResourceListResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkResourceListResult; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceListResultImpl implements PrivateLinkResourceListResult { + private PrivateLinkResourceListResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + PrivateLinkResourceListResultImpl( + PrivateLinkResourceListResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupImpl.java new file mode 100644 index 0000000000000..c23a0bd8a37da --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroup; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupType; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupUpdate; +import com.azure.resourcemanager.compute.generated.models.SubResourceWithColocationStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ProximityPlacementGroupImpl + implements ProximityPlacementGroup, ProximityPlacementGroup.Definition, ProximityPlacementGroup.Update { + private ProximityPlacementGroupInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 ProximityPlacementGroupType proximityPlacementGroupType() { + return this.innerModel().proximityPlacementGroupType(); + } + + public List virtualMachines() { + List inner = this.innerModel().virtualMachines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List virtualMachineScaleSets() { + List inner = this.innerModel().virtualMachineScaleSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List availabilitySets() { + List inner = this.innerModel().availabilitySets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public InstanceViewStatus colocationStatus() { + return this.innerModel().colocationStatus(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ProximityPlacementGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String proximityPlacementGroupName; + + private ProximityPlacementGroupUpdate updateParameters; + + public ProximityPlacementGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ProximityPlacementGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .createOrUpdateWithResponse( + resourceGroupName, proximityPlacementGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ProximityPlacementGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .createOrUpdateWithResponse(resourceGroupName, proximityPlacementGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + ProximityPlacementGroupImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new ProximityPlacementGroupInner(); + this.serviceManager = serviceManager; + this.proximityPlacementGroupName = name; + } + + public ProximityPlacementGroupImpl update() { + this.updateParameters = new ProximityPlacementGroupUpdate(); + return this; + } + + public ProximityPlacementGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .updateWithResponse(resourceGroupName, proximityPlacementGroupName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public ProximityPlacementGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .updateWithResponse(resourceGroupName, proximityPlacementGroupName, updateParameters, context) + .getValue(); + return this; + } + + ProximityPlacementGroupImpl( + ProximityPlacementGroupInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.proximityPlacementGroupName = Utils.getValueFromIdByName(innerObject.id(), "proximityPlacementGroups"); + } + + public ProximityPlacementGroup refresh() { + String localIncludeColocationStatus = null; + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .getByResourceGroupWithResponse( + resourceGroupName, proximityPlacementGroupName, localIncludeColocationStatus, Context.NONE) + .getValue(); + return this; + } + + public ProximityPlacementGroup refresh(Context context) { + String localIncludeColocationStatus = null; + this.innerObject = + serviceManager + .serviceClient() + .getProximityPlacementGroups() + .getByResourceGroupWithResponse( + resourceGroupName, proximityPlacementGroupName, localIncludeColocationStatus, context) + .getValue(); + return this; + } + + public ProximityPlacementGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProximityPlacementGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProximityPlacementGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ProximityPlacementGroupImpl withProximityPlacementGroupType( + ProximityPlacementGroupType proximityPlacementGroupType) { + this.innerModel().withProximityPlacementGroupType(proximityPlacementGroupType); + return this; + } + + public ProximityPlacementGroupImpl withColocationStatus(InstanceViewStatus colocationStatus) { + this.innerModel().withColocationStatus(colocationStatus); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsClientImpl.java new file mode 100644 index 0000000000000..1c67766641816 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsClientImpl.java @@ -0,0 +1,1348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.ProximityPlacementGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupListResult; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProximityPlacementGroupsClient. */ +public final class ProximityPlacementGroupsClientImpl implements ProximityPlacementGroupsClient { + private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ProximityPlacementGroupsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of ProximityPlacementGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProximityPlacementGroupsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(ProximityPlacementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientProximityPlacementGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface ProximityPlacementGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/proximityPlacementGroups/{proximityPlacementGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("proximityPlacementGroupName") String proximityPlacementGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ProximityPlacementGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/proximityPlacementGroups/{proximityPlacementGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("proximityPlacementGroupName") String proximityPlacementGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ProximityPlacementGroupUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/proximityPlacementGroups/{proximityPlacementGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("proximityPlacementGroupName") String proximityPlacementGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/proximityPlacementGroups/{proximityPlacementGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("proximityPlacementGroupName") String proximityPlacementGroupName, + @QueryParam("includeColocationStatus") String includeColocationStatus, + @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.Compute/proximityPlacementGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/proximityPlacementGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @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(ApiErrorException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProximityPlacementGroupInner createOrUpdate( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters).block(); + } + + /** + * Create or update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Create Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters, context) + .block(); + } + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProximityPlacementGroupInner update( + String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupUpdate parameters) { + return updateAsync(resourceGroupName, proximityPlacementGroupName, parameters).block(); + } + + /** + * Update a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param parameters Parameters supplied to the Update Proximity Placement Group operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String proximityPlacementGroupName, + ProximityPlacementGroupUpdate parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, proximityPlacementGroupName, parameters, context).block(); + } + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 proximityPlacementGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 proximityPlacementGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 proximityPlacementGroupName) { + return deleteWithResponseAsync(resourceGroupName, proximityPlacementGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 proximityPlacementGroupName) { + deleteAsync(resourceGroupName, proximityPlacementGroupName).block(); + } + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String proximityPlacementGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, proximityPlacementGroupName, context).block(); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + includeColocationStatus, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (proximityPlacementGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proximityPlacementGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + proximityPlacementGroupName, + includeColocationStatus, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, proximityPlacementGroupName, includeColocationStatus) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String proximityPlacementGroupName) { + final String includeColocationStatus = null; + return getByResourceGroupWithResponseAsync( + resourceGroupName, proximityPlacementGroupName, includeColocationStatus) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProximityPlacementGroupInner getByResourceGroup( + String resourceGroupName, String proximityPlacementGroupName) { + final String includeColocationStatus = null; + return getByResourceGroupAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus).block(); + } + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, proximityPlacementGroupName, includeColocationStatus, context) + .block(); + } + + /** + * Lists all proximity placement groups in a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 proximity placement groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all proximity placement groups in a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all proximity placement groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all proximity placement groups in a subscription. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all proximity placement groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsImpl.java new file mode 100644 index 0000000000000..a67f23f950564 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ProximityPlacementGroupsImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.ProximityPlacementGroupsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroup; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ProximityPlacementGroupsImpl implements ProximityPlacementGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupsImpl.class); + + private final ProximityPlacementGroupsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public ProximityPlacementGroupsImpl( + ProximityPlacementGroupsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String proximityPlacementGroupName) { + this.serviceClient().delete(resourceGroupName, proximityPlacementGroupName); + } + + public Response deleteWithResponse( + String resourceGroupName, String proximityPlacementGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, proximityPlacementGroupName, context); + } + + public ProximityPlacementGroup getByResourceGroup(String resourceGroupName, String proximityPlacementGroupName) { + ProximityPlacementGroupInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, proximityPlacementGroupName); + if (inner != null) { + return new ProximityPlacementGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse( + resourceGroupName, proximityPlacementGroupName, includeColocationStatus, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProximityPlacementGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ProximityPlacementGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ProximityPlacementGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ProximityPlacementGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ProximityPlacementGroupImpl(inner1, this.manager())); + } + + public ProximityPlacementGroup getById(String id) { + String resourceGroupName = Utils.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 proximityPlacementGroupName = Utils.getValueFromIdByName(id, "proximityPlacementGroups"); + if (proximityPlacementGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'proximityPlacementGroups'.", + id))); + } + String localIncludeColocationStatus = null; + return this + .getByResourceGroupWithResponse( + resourceGroupName, proximityPlacementGroupName, localIncludeColocationStatus, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, String includeColocationStatus, Context context) { + String resourceGroupName = Utils.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 proximityPlacementGroupName = Utils.getValueFromIdByName(id, "proximityPlacementGroups"); + if (proximityPlacementGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'proximityPlacementGroups'.", + id))); + } + return this + .getByResourceGroupWithResponse( + resourceGroupName, proximityPlacementGroupName, includeColocationStatus, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 proximityPlacementGroupName = Utils.getValueFromIdByName(id, "proximityPlacementGroups"); + if (proximityPlacementGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'proximityPlacementGroups'.", + id))); + } + this.deleteWithResponse(resourceGroupName, proximityPlacementGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 proximityPlacementGroupName = Utils.getValueFromIdByName(id, "proximityPlacementGroups"); + if (proximityPlacementGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'proximityPlacementGroups'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, proximityPlacementGroupName, context); + } + + private ProximityPlacementGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public ProximityPlacementGroupImpl define(String name) { + return new ProximityPlacementGroupImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RecoveryWalkResponseImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RecoveryWalkResponseImpl.java new file mode 100644 index 0000000000000..4b9d04c8653d6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RecoveryWalkResponseImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RecoveryWalkResponseInner; +import com.azure.resourcemanager.compute.generated.models.RecoveryWalkResponse; + +public final class RecoveryWalkResponseImpl implements RecoveryWalkResponse { + private RecoveryWalkResponseInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RecoveryWalkResponseImpl( + RecoveryWalkResponseInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean walkPerformed() { + return this.innerModel().walkPerformed(); + } + + public Integer nextPlatformUpdateDomain() { + return this.innerModel().nextPlatformUpdateDomain(); + } + + public RecoveryWalkResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkuImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkuImpl.java new file mode 100644 index 0000000000000..b699f8fd9ff57 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkuImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.compute.generated.models.ResourceSku; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCapabilities; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCapacity; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuCosts; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuLocationInfo; +import com.azure.resourcemanager.compute.generated.models.ResourceSkuRestrictions; +import java.util.Collections; +import java.util.List; + +public final class ResourceSkuImpl implements ResourceSku { + private ResourceSkuInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + ResourceSkuImpl( + ResourceSkuInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String name() { + return this.innerModel().name(); + } + + public String tier() { + return this.innerModel().tier(); + } + + public String size() { + return this.innerModel().size(); + } + + public String family() { + return this.innerModel().family(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ResourceSkuCapacity capacity() { + return this.innerModel().capacity(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locationInfo() { + List inner = this.innerModel().locationInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List apiVersions() { + List inner = this.innerModel().apiVersions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List costs() { + List inner = this.innerModel().costs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List restrictions() { + List inner = this.innerModel().restrictions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceSkuInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusClientImpl.java new file mode 100644 index 0000000000000..28385afb19de4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusClientImpl.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.ResourceSkusClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.compute.generated.models.ResourceSkusResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceSkusClient. */ +public final class ResourceSkusClientImpl implements ResourceSkusClient { + private final ClientLogger logger = new ClientLogger(ResourceSkusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceSkusService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of ResourceSkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceSkusClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(ResourceSkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientResourceSkus to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface ResourceSkusService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @QueryParam("includeExtendedLocations") String includeExtendedLocations, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String includeExtendedLocations) { + 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 apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + filter, + includeExtendedLocations, + 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 the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, String includeExtendedLocations, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + filter, + includeExtendedLocations, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String includeExtendedLocations) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, includeExtendedLocations), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your 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 the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String includeExtendedLocations = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, includeExtendedLocations), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String includeExtendedLocations, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, includeExtendedLocations, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your 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 the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String includeExtendedLocations = null; + return new PagedIterable<>(listAsync(filter, includeExtendedLocations)); + } + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String includeExtendedLocations, Context context) { + return new PagedIterable<>(listAsync(filter, includeExtendedLocations, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Resource Skus operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Resource Skus operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusImpl.java new file mode 100644 index 0000000000000..7590627d7bf2e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/ResourceSkusImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.ResourceSkusClient; +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.compute.generated.models.ResourceSku; +import com.azure.resourcemanager.compute.generated.models.ResourceSkus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceSkusImpl implements ResourceSkus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkusImpl.class); + + private final ResourceSkusClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public ResourceSkusImpl( + ResourceSkusClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceSkuImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String includeExtendedLocations, Context context) { + PagedIterable inner = this.serviceClient().list(filter, includeExtendedLocations, context); + return Utils.mapPage(inner, inner1 -> new ResourceSkuImpl(inner1, this.manager())); + } + + private ResourceSkusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionImpl.java new file mode 100644 index 0000000000000..77e46fccfb51b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.generated.models.RestorePoint; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollection; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionUpdate; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class RestorePointCollectionImpl + implements RestorePointCollection, RestorePointCollection.Definition, RestorePointCollection.Update { + private RestorePointCollectionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 RestorePointCollectionSourceProperties source() { + return this.innerModel().source(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String restorePointCollectionId() { + return this.innerModel().restorePointCollectionId(); + } + + public List restorePoints() { + List inner = this.innerModel().restorePoints(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RestorePointImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public RestorePointCollectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String restorePointCollectionName; + + private RestorePointCollectionUpdate updateParameters; + + public RestorePointCollectionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public RestorePointCollection create() { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .createOrUpdateWithResponse( + resourceGroupName, restorePointCollectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public RestorePointCollection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .createOrUpdateWithResponse(resourceGroupName, restorePointCollectionName, this.innerModel(), context) + .getValue(); + return this; + } + + RestorePointCollectionImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new RestorePointCollectionInner(); + this.serviceManager = serviceManager; + this.restorePointCollectionName = name; + } + + public RestorePointCollectionImpl update() { + this.updateParameters = new RestorePointCollectionUpdate(); + return this; + } + + public RestorePointCollection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .updateWithResponse(resourceGroupName, restorePointCollectionName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public RestorePointCollection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .updateWithResponse(resourceGroupName, restorePointCollectionName, updateParameters, context) + .getValue(); + return this; + } + + RestorePointCollectionImpl( + RestorePointCollectionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.restorePointCollectionName = Utils.getValueFromIdByName(innerObject.id(), "restorePointCollections"); + } + + public RestorePointCollection refresh() { + RestorePointCollectionExpandOptions localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .getByResourceGroupWithResponse( + resourceGroupName, restorePointCollectionName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public RestorePointCollection refresh(Context context) { + RestorePointCollectionExpandOptions localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getRestorePointCollections() + .getByResourceGroupWithResponse(resourceGroupName, restorePointCollectionName, localExpand, context) + .getValue(); + return this; + } + + public RestorePointCollectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public RestorePointCollectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public RestorePointCollectionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public RestorePointCollectionImpl withSource(RestorePointCollectionSourceProperties source) { + if (isInCreateMode()) { + this.innerModel().withSource(source); + return this; + } else { + this.updateParameters.withSource(source); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsClientImpl.java new file mode 100644 index 0000000000000..d015c85d4ed68 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsClientImpl.java @@ -0,0 +1,1469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.RestorePointCollectionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionListResult; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionUpdate; +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 RestorePointCollectionsClient. */ +public final class RestorePointCollectionsClientImpl implements RestorePointCollectionsClient { + private final ClientLogger logger = new ClientLogger(RestorePointCollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorePointCollectionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of RestorePointCollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorePointCollectionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(RestorePointCollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientRestorePointCollections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface RestorePointCollectionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RestorePointCollectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RestorePointCollectionUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @QueryParam("$expand") RestorePointCollectionExpandOptions expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionInner parameters) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + parameters, + accept, + context); + } + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, restorePointCollectionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointCollectionInner createOrUpdate( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, restorePointCollectionName, parameters).block(); + } + + /** + * The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for + * more details. When updating a restore point collection, only tags may be modified. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Create or Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, restorePointCollectionName, parameters, context) + .block(); + } + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionUpdate parameters) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + parameters, + accept, + context); + } + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, restorePointCollectionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointCollectionInner update( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionUpdate parameters) { + return updateAsync(resourceGroupName, restorePointCollectionName, parameters).block(); + } + + /** + * The operation to update the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param parameters Parameters supplied to the Update restore point collection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionUpdate parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, restorePointCollectionName, parameters, context).block(); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 restorePointCollectionName) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 restorePointCollectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + apiVersion, + accept, + context); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String restorePointCollectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, restorePointCollectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String restorePointCollectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, restorePointCollectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String restorePointCollectionName) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName).getSyncPoller(); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, context).getSyncPoller(); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName) { + deleteAsync(resourceGroupName, restorePointCollectionName).block(); + } + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, Context context) { + deleteAsync(resourceGroupName, restorePointCollectionName, context).block(); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionExpandOptions expand) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + expand, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionExpandOptions expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + expand, + apiVersion, + accept, + context); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String restorePointCollectionName, RestorePointCollectionExpandOptions expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, restorePointCollectionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String restorePointCollectionName) { + final RestorePointCollectionExpandOptions expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, restorePointCollectionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointCollectionInner getByResourceGroup(String resourceGroupName, String restorePointCollectionName) { + final RestorePointCollectionExpandOptions expand = null; + return getByResourceGroupAsync(resourceGroupName, restorePointCollectionName, expand).block(); + } + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionExpandOptions expand, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, restorePointCollectionName, expand, context) + .block(); + } + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List restore point collection operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List restore point collection operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List restore point collection operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List restore point collection operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsImpl.java new file mode 100644 index 0000000000000..df2ec9da93d29 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointCollectionsImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.RestorePointCollectionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollection; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorePointCollectionsImpl implements RestorePointCollections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionsImpl.class); + + private final RestorePointCollectionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public RestorePointCollectionsImpl( + RestorePointCollectionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String restorePointCollectionName) { + this.serviceClient().delete(resourceGroupName, restorePointCollectionName); + } + + public void delete(String resourceGroupName, String restorePointCollectionName, Context context) { + this.serviceClient().delete(resourceGroupName, restorePointCollectionName, context); + } + + public RestorePointCollection getByResourceGroup(String resourceGroupName, String restorePointCollectionName) { + RestorePointCollectionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, restorePointCollectionName); + if (inner != null) { + return new RestorePointCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionExpandOptions expand, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, restorePointCollectionName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorePointCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new RestorePointCollectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new RestorePointCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RestorePointCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new RestorePointCollectionImpl(inner1, this.manager())); + } + + public RestorePointCollection getById(String id) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + RestorePointCollectionExpandOptions localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, restorePointCollectionName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, RestorePointCollectionExpandOptions expand, Context context) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, restorePointCollectionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + this.delete(resourceGroupName, restorePointCollectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + this.delete(resourceGroupName, restorePointCollectionName, context); + } + + private RestorePointCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public RestorePointCollectionImpl define(String name) { + return new RestorePointCollectionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..33a3b2700a255 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointImpl.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.ConsistencyModeTypes; +import com.azure.resourcemanager.compute.generated.models.RestorePoint; +import com.azure.resourcemanager.compute.generated.models.RestorePointExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePointInstanceView; +import com.azure.resourcemanager.compute.generated.models.RestorePointSourceMetadata; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class RestorePointImpl implements RestorePoint, RestorePoint.Definition { + private RestorePointInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RestorePointImpl( + RestorePointInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 List excludeDisks() { + List inner = this.innerModel().excludeDisks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RestorePointSourceMetadata sourceMetadata() { + return this.innerModel().sourceMetadata(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ConsistencyModeTypes consistencyMode() { + return this.innerModel().consistencyMode(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public ApiEntityReference sourceRestorePoint() { + return this.innerModel().sourceRestorePoint(); + } + + public RestorePointInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public RestorePointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String restorePointCollectionName; + + private String restorePointName; + + public RestorePointImpl withExistingRestorePointCollection( + String resourceGroupName, String restorePointCollectionName) { + this.resourceGroupName = resourceGroupName; + this.restorePointCollectionName = restorePointCollectionName; + return this; + } + + public RestorePoint create() { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePoints() + .create( + resourceGroupName, restorePointCollectionName, restorePointName, this.innerModel(), Context.NONE); + return this; + } + + public RestorePoint create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRestorePoints() + .create(resourceGroupName, restorePointCollectionName, restorePointName, this.innerModel(), context); + return this; + } + + RestorePointImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new RestorePointInner(); + this.serviceManager = serviceManager; + this.restorePointName = name; + } + + public RestorePoint refresh() { + RestorePointExpandOptions localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getRestorePoints() + .getWithResponse( + resourceGroupName, restorePointCollectionName, restorePointName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public RestorePoint refresh(Context context) { + RestorePointExpandOptions localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getRestorePoints() + .getWithResponse(resourceGroupName, restorePointCollectionName, restorePointName, localExpand, context) + .getValue(); + return this; + } + + public RestorePointImpl withExcludeDisks(List excludeDisks) { + this.innerModel().withExcludeDisks(excludeDisks); + return this; + } + + public RestorePointImpl withTimeCreated(OffsetDateTime timeCreated) { + this.innerModel().withTimeCreated(timeCreated); + return this; + } + + public RestorePointImpl withSourceRestorePoint(ApiEntityReference sourceRestorePoint) { + this.innerModel().withSourceRestorePoint(sourceRestorePoint); + return this; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsClientImpl.java new file mode 100644 index 0000000000000..bd0e115036318 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsClientImpl.java @@ -0,0 +1,941 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.polling.PollResult; +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.compute.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.RestorePointExpandOptions; +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 RestorePointsClient. */ +public final class RestorePointsClientImpl implements RestorePointsClient { + private final ClientLogger logger = new ClientLogger(RestorePointsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RestorePointsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorePointsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(RestorePointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientRestorePoints to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface RestorePointsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("restorePointName") String restorePointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RestorePointInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("restorePointName") String restorePointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("restorePointCollectionName") String restorePointCollectionName, + @PathParam("restorePointName") String restorePointName, + @QueryParam("$expand") RestorePointExpandOptions expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + apiVersion, + parameters, + accept, + context); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RestorePointInner.class, + RestorePointInner.class, + this.client.getContext()); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync( + resourceGroupName, restorePointCollectionName, restorePointName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RestorePointInner.class, RestorePointInner.class, context); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters) { + return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters) + .getSyncPoller(); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context) + .getSyncPoller(); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters) { + return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters) { + return createAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters).block(); + } + + /** + * The operation to create the restore point. Updating properties of an existing restore point is not allowed. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param parameters Parameters supplied to the Create restore point operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointInner parameters, + Context context) { + return createAsync(resourceGroupName, restorePointCollectionName, restorePointName, parameters, context) + .block(); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 restorePointCollectionName, String restorePointName) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 restorePointCollectionName, String restorePointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + apiVersion, + accept, + context); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String restorePointCollectionName, String restorePointName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String restorePointCollectionName, String restorePointName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, String restorePointName) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).getSyncPoller(); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String restorePointCollectionName, String restorePointName, Context context) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context) + .getSyncPoller(); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, String restorePointName) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, String restorePointName, Context context) { + return beginDeleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, String restorePointName) { + deleteAsync(resourceGroupName, restorePointCollectionName, restorePointName).block(); + } + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 restorePointCollectionName, String restorePointName, Context context) { + deleteAsync(resourceGroupName, restorePointCollectionName, restorePointName, context).block(); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand) { + 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 (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + expand, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (restorePointCollectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorePointCollectionName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + restorePointCollectionName, + restorePointName, + expand, + apiVersion, + accept, + context); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand) { + return getWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String restorePointCollectionName, String restorePointName) { + final RestorePointExpandOptions expand = null; + return getWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner get(String resourceGroupName, String restorePointCollectionName, String restorePointName) { + final RestorePointExpandOptions expand = null; + return getAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand).block(); + } + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand, + Context context) { + return getWithResponseAsync(resourceGroupName, restorePointCollectionName, restorePointName, expand, context) + .block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..eb0e3bac158cc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RestorePointsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.generated.models.RestorePoint; +import com.azure.resourcemanager.compute.generated.models.RestorePointExpandOptions; +import com.azure.resourcemanager.compute.generated.models.RestorePoints; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RestorePointsImpl implements RestorePoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointsImpl.class); + + private final RestorePointsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public RestorePointsImpl( + RestorePointsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String restorePointCollectionName, String restorePointName) { + this.serviceClient().delete(resourceGroupName, restorePointCollectionName, restorePointName); + } + + public void delete( + String resourceGroupName, String restorePointCollectionName, String restorePointName, Context context) { + this.serviceClient().delete(resourceGroupName, restorePointCollectionName, restorePointName, context); + } + + public RestorePoint get(String resourceGroupName, String restorePointCollectionName, String restorePointName) { + RestorePointInner inner = + this.serviceClient().get(resourceGroupName, restorePointCollectionName, restorePointName); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, restorePointCollectionName, restorePointName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorePointImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RestorePoint getById(String id) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + String restorePointName = Utils.getValueFromIdByName(id, "restorePoints"); + if (restorePointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'restorePoints'.", id))); + } + RestorePointExpandOptions localExpand = null; + return this + .getWithResponse(resourceGroupName, restorePointCollectionName, restorePointName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, RestorePointExpandOptions expand, Context context) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + String restorePointName = Utils.getValueFromIdByName(id, "restorePoints"); + if (restorePointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'restorePoints'.", id))); + } + return this.getWithResponse(resourceGroupName, restorePointCollectionName, restorePointName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + String restorePointName = Utils.getValueFromIdByName(id, "restorePoints"); + if (restorePointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'restorePoints'.", id))); + } + this.delete(resourceGroupName, restorePointCollectionName, restorePointName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 restorePointCollectionName = Utils.getValueFromIdByName(id, "restorePointCollections"); + if (restorePointCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'restorePointCollections'.", + id))); + } + String restorePointName = Utils.getValueFromIdByName(id, "restorePoints"); + if (restorePointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'restorePoints'.", id))); + } + this.delete(resourceGroupName, restorePointCollectionName, restorePointName, context); + } + + private RestorePointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public RestorePointImpl define(String name) { + return new RestorePointImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RetrieveBootDiagnosticsDataResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RetrieveBootDiagnosticsDataResultImpl.java new file mode 100644 index 0000000000000..92ae008e28534 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RetrieveBootDiagnosticsDataResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.models.RetrieveBootDiagnosticsDataResult; + +public final class RetrieveBootDiagnosticsDataResultImpl implements RetrieveBootDiagnosticsDataResult { + private RetrieveBootDiagnosticsDataResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RetrieveBootDiagnosticsDataResultImpl( + RetrieveBootDiagnosticsDataResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String consoleScreenshotBlobUri() { + return this.innerModel().consoleScreenshotBlobUri(); + } + + public String serialConsoleLogBlobUri() { + return this.innerModel().serialConsoleLogBlobUri(); + } + + public RetrieveBootDiagnosticsDataResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceImpl.java new file mode 100644 index 0000000000000..7162bf34c51f8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstancePropertiesInner; +import com.azure.resourcemanager.compute.generated.models.InstanceSku; +import com.azure.resourcemanager.compute.generated.models.RoleInstance; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceProperties; +import java.util.Collections; +import java.util.Map; + +public final class RoleInstanceImpl implements RoleInstance { + private RoleInstanceInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RoleInstanceImpl( + RoleInstanceInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager 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 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 InstanceSku sku() { + return this.innerModel().sku(); + } + + public RoleInstanceProperties properties() { + RoleInstancePropertiesInner inner = this.innerModel().properties(); + if (inner != null) { + return new RoleInstancePropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public RoleInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstancePropertiesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstancePropertiesImpl.java new file mode 100644 index 0000000000000..01cae7f0c0c0e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstancePropertiesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstancePropertiesInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceProperties; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceView; + +public final class RoleInstancePropertiesImpl implements RoleInstanceProperties { + private RoleInstancePropertiesInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RoleInstancePropertiesImpl( + RoleInstancePropertiesInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public RoleInstanceNetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public RoleInstanceView instanceView() { + RoleInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new RoleInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public RoleInstancePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceViewImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceViewImpl.java new file mode 100644 index 0000000000000..8fb1b043a1576 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RoleInstanceViewImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.ResourceInstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.RoleInstanceView; +import java.util.Collections; +import java.util.List; + +public final class RoleInstanceViewImpl implements RoleInstanceView { + private RoleInstanceViewInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RoleInstanceViewImpl( + RoleInstanceViewInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer platformUpdateDomain() { + return this.innerModel().platformUpdateDomain(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public String privateId() { + return this.innerModel().privateId(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RoleInstanceViewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RollingUpgradeStatusInfoImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RollingUpgradeStatusInfoImpl.java new file mode 100644 index 0000000000000..0a5d024c3b198 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RollingUpgradeStatusInfoImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RollingUpgradeStatusInfoInner; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeProgressInfo; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeRunningStatus; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeStatusInfo; +import java.util.Collections; +import java.util.Map; + +public final class RollingUpgradeStatusInfoImpl implements RollingUpgradeStatusInfo { + private RollingUpgradeStatusInfoInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RollingUpgradeStatusInfoImpl( + RollingUpgradeStatusInfoInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager 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 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 RollingUpgradePolicy policy() { + return this.innerModel().policy(); + } + + public RollingUpgradeRunningStatus runningStatus() { + return this.innerModel().runningStatus(); + } + + public RollingUpgradeProgressInfo progress() { + return this.innerModel().progress(); + } + + public ApiError error() { + return this.innerModel().error(); + } + + public RollingUpgradeStatusInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentBaseImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentBaseImpl.java new file mode 100644 index 0000000000000..8891dcb14b696 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentBaseImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandDocumentBase; + +public final class RunCommandDocumentBaseImpl implements RunCommandDocumentBase { + private RunCommandDocumentBaseInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RunCommandDocumentBaseImpl( + RunCommandDocumentBaseInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String schema() { + return this.innerModel().schema(); + } + + public String id() { + return this.innerModel().id(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public String label() { + return this.innerModel().label(); + } + + public String description() { + return this.innerModel().description(); + } + + public RunCommandDocumentBaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentImpl.java new file mode 100644 index 0000000000000..c174d60199592 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandDocumentImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandDocument; +import com.azure.resourcemanager.compute.generated.models.RunCommandParameterDefinition; +import java.util.Collections; +import java.util.List; + +public final class RunCommandDocumentImpl implements RunCommandDocument { + private RunCommandDocumentInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RunCommandDocumentImpl( + RunCommandDocumentInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String schema() { + return this.innerModel().schema(); + } + + public String id() { + return this.innerModel().id(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public String label() { + return this.innerModel().label(); + } + + public String description() { + return this.innerModel().description(); + } + + public List script() { + List inner = this.innerModel().script(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List parameters() { + List inner = this.innerModel().parameters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RunCommandDocumentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandResultImpl.java new file mode 100644 index 0000000000000..4afb8aa9655f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/RunCommandResultImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.RunCommandResult; +import java.util.Collections; +import java.util.List; + +public final class RunCommandResultImpl implements RunCommandResult { + private RunCommandResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + RunCommandResultImpl( + RunCommandResultInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RunCommandResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesClientImpl.java new file mode 100644 index 0000000000000..afda05077038f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesClientImpl.java @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryList; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SharedGalleriesClient. */ +public final class SharedGalleriesClientImpl implements SharedGalleriesClient { + private final ClientLogger logger = new ClientLogger(SharedGalleriesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SharedGalleriesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of SharedGalleriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedGalleriesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(SharedGalleriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientSharedGalleries to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface SharedGalleriesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @QueryParam("sharedTo") SharedToValues sharedTo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + + "/{galleryUniqueName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("galleryUniqueName") String galleryUniqueName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, SharedToValues sharedTo) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + sharedTo, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, SharedToValues sharedTo, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + sharedTo, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, SharedToValues sharedTo) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, sharedTo), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location) { + final SharedToValues sharedTo = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, sharedTo), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, SharedToValues sharedTo, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, sharedTo, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location) { + final SharedToValues sharedTo = null; + return new PagedIterable<>(listAsync(location, sharedTo)); + } + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, SharedToValues sharedTo, Context context) { + return new PagedIterable<>(listAsync(location, sharedTo, context)); + } + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String galleryUniqueName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + galleryUniqueName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String galleryUniqueName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + galleryUniqueName, + apiVersion, + accept, + context); + } + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String galleryUniqueName) { + return getWithResponseAsync(location, galleryUniqueName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedGalleryInner get(String location, String galleryUniqueName) { + return getAsync(location, galleryUniqueName).block(); + } + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String galleryUniqueName, Context context) { + return getWithResponseAsync(location, galleryUniqueName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesImpl.java new file mode 100644 index 0000000000000..eb310b96c9282 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleriesImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.SharedGalleriesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner; +import com.azure.resourcemanager.compute.generated.models.SharedGalleries; +import com.azure.resourcemanager.compute.generated.models.SharedGallery; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SharedGalleriesImpl implements SharedGalleries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleriesImpl.class); + + private final SharedGalleriesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public SharedGalleriesImpl( + SharedGalleriesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, SharedToValues sharedTo, Context context) { + PagedIterable inner = this.serviceClient().list(location, sharedTo, context); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImpl(inner1, this.manager())); + } + + public SharedGallery get(String location, String galleryUniqueName) { + SharedGalleryInner inner = this.serviceClient().get(location, galleryUniqueName); + if (inner != null) { + return new SharedGalleryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String galleryUniqueName, Context context) { + Response inner = this.serviceClient().getWithResponse(location, galleryUniqueName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedGalleryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SharedGalleriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageImpl.java new file mode 100644 index 0000000000000..9ad7e3bdc84f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.Disallowed; +import com.azure.resourcemanager.compute.generated.models.GalleryImageFeature; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.ImagePurchasePlan; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.RecommendedMachineConfiguration; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImage; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class SharedGalleryImageImpl implements SharedGalleryImage { + private SharedGalleryImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + SharedGalleryImageImpl( + SharedGalleryImageInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public OperatingSystemStateTypes osState() { + return this.innerModel().osState(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public GalleryImageIdentifier identifier() { + return this.innerModel().identifier(); + } + + public RecommendedMachineConfiguration recommended() { + return this.innerModel().recommended(); + } + + public Disallowed disallowed() { + return this.innerModel().disallowed(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public List features() { + List inner = this.innerModel().features(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ImagePurchasePlan purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public SharedGalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionImpl.java new file mode 100644 index 0000000000000..8957b7cf5d3be --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageVersion; +import java.time.OffsetDateTime; + +public final class SharedGalleryImageVersionImpl implements SharedGalleryImageVersion { + private SharedGalleryImageVersionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + SharedGalleryImageVersionImpl( + SharedGalleryImageVersionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public OffsetDateTime publishedDate() { + return this.innerModel().publishedDate(); + } + + public OffsetDateTime endOfLifeDate() { + return this.innerModel().endOfLifeDate(); + } + + public SharedGalleryImageVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsClientImpl.java new file mode 100644 index 0000000000000..9146298eeb016 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsClientImpl.java @@ -0,0 +1,631 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageVersionList; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SharedGalleryImageVersionsClient. */ +public final class SharedGalleryImageVersionsClientImpl implements SharedGalleryImageVersionsClient { + private final ClientLogger logger = new ClientLogger(SharedGalleryImageVersionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SharedGalleryImageVersionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of SharedGalleryImageVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedGalleryImageVersionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + SharedGalleryImageVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientSharedGalleryImageVersions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface SharedGalleryImageVersionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + + "/{galleryUniqueName}/images/{galleryImageName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("galleryUniqueName") String galleryUniqueName, + @PathParam("galleryImageName") String galleryImageName, + @QueryParam("sharedTo") SharedToValues sharedTo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + + "/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("galleryUniqueName") String galleryUniqueName, + @PathParam("galleryImageName") String galleryImageName, + @PathParam("galleryImageVersionName") String galleryImageVersionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + sharedTo, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + sharedTo, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, galleryImageName, sharedTo), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String galleryUniqueName, String galleryImageName) { + final SharedToValues sharedTo = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, galleryImageName, sharedTo), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, galleryImageName, sharedTo, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String galleryUniqueName, String galleryImageName) { + final SharedToValues sharedTo = null; + return new PagedIterable<>(listAsync(location, galleryUniqueName, galleryImageName, sharedTo)); + } + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context) { + return new PagedIterable<>(listAsync(location, galleryUniqueName, galleryImageName, sharedTo, context)); + } + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + galleryImageVersionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, + String galleryUniqueName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (galleryImageVersionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter galleryImageVersionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + galleryImageVersionName, + accept, + context); + } + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName) { + return getWithResponseAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedGalleryImageVersionInner get( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName) { + return getAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName).block(); + } + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, + String galleryUniqueName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + return getWithResponseAsync(location, galleryUniqueName, galleryImageName, galleryImageVersionName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsImpl.java new file mode 100644 index 0000000000000..d606213f05f6e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImageVersionsImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.SharedGalleryImageVersionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageVersions; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SharedGalleryImageVersionsImpl implements SharedGalleryImageVersions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageVersionsImpl.class); + + private final SharedGalleryImageVersionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public SharedGalleryImageVersionsImpl( + SharedGalleryImageVersionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String location, String galleryUniqueName, String galleryImageName) { + PagedIterable inner = + this.serviceClient().list(location, galleryUniqueName, galleryImageName); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImageVersionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context) { + PagedIterable inner = + this.serviceClient().list(location, galleryUniqueName, galleryImageName, sharedTo, context); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImageVersionImpl(inner1, this.manager())); + } + + public SharedGalleryImageVersion get( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName) { + SharedGalleryImageVersionInner inner = + this.serviceClient().get(location, galleryUniqueName, galleryImageName, galleryImageVersionName); + if (inner != null) { + return new SharedGalleryImageVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, + String galleryUniqueName, + String galleryImageName, + String galleryImageVersionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(location, galleryUniqueName, galleryImageName, galleryImageVersionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedGalleryImageVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SharedGalleryImageVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesClientImpl.java new file mode 100644 index 0000000000000..322be08aa3dc9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesClientImpl.java @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.SharedGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImageList; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SharedGalleryImagesClient. */ +public final class SharedGalleryImagesClientImpl implements SharedGalleryImagesClient { + private final ClientLogger logger = new ClientLogger(SharedGalleryImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SharedGalleryImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of SharedGalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedGalleryImagesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(SharedGalleryImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientSharedGalleryImages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface SharedGalleryImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + + "/{galleryUniqueName}/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("galleryUniqueName") String galleryUniqueName, + @QueryParam("sharedTo") SharedToValues sharedTo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + + "/{galleryUniqueName}/images/{galleryImageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("galleryUniqueName") String galleryUniqueName, + @PathParam("galleryImageName") String galleryImageName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String galleryUniqueName, SharedToValues sharedTo) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + sharedTo, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + sharedTo, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String galleryUniqueName, SharedToValues sharedTo) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, sharedTo), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, String galleryUniqueName) { + final SharedToValues sharedTo = null; + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, sharedTo), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, galleryUniqueName, sharedTo, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, String galleryUniqueName) { + final SharedToValues sharedTo = null; + return new PagedIterable<>(listAsync(location, galleryUniqueName, sharedTo)); + } + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context) { + return new PagedIterable<>(listAsync(location, galleryUniqueName, sharedTo, context)); + } + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String galleryUniqueName, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String galleryUniqueName, String galleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (galleryUniqueName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryUniqueName is required and cannot be null.")); + } + if (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + apiVersion, + galleryUniqueName, + galleryImageName, + accept, + context); + } + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String galleryUniqueName, String galleryImageName) { + return getWithResponseAsync(location, galleryUniqueName, galleryImageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedGalleryImageInner get(String location, String galleryUniqueName, String galleryImageName) { + return getAsync(location, galleryUniqueName, galleryImageName).block(); + } + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, String galleryUniqueName, String galleryImageName, Context context) { + return getWithResponseAsync(location, galleryUniqueName, galleryImageName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesImpl.java new file mode 100644 index 0000000000000..619a182b5aab8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImagesImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.SharedGalleryImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImage; +import com.azure.resourcemanager.compute.generated.models.SharedGalleryImages; +import com.azure.resourcemanager.compute.generated.models.SharedToValues; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SharedGalleryImagesImpl implements SharedGalleryImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImagesImpl.class); + + private final SharedGalleryImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public SharedGalleryImagesImpl( + SharedGalleryImagesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location, String galleryUniqueName) { + PagedIterable inner = this.serviceClient().list(location, galleryUniqueName); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context) { + PagedIterable inner = + this.serviceClient().list(location, galleryUniqueName, sharedTo, context); + return Utils.mapPage(inner, inner1 -> new SharedGalleryImageImpl(inner1, this.manager())); + } + + public SharedGalleryImage get(String location, String galleryUniqueName, String galleryImageName) { + SharedGalleryImageInner inner = this.serviceClient().get(location, galleryUniqueName, galleryImageName); + if (inner != null) { + return new SharedGalleryImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, String galleryUniqueName, String galleryImageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, galleryUniqueName, galleryImageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedGalleryImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SharedGalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImpl.java new file mode 100644 index 0000000000000..d8fdf33036ec2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharedGalleryImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner; +import com.azure.resourcemanager.compute.generated.models.SharedGallery; + +public final class SharedGalleryImpl implements SharedGallery { + private SharedGalleryInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + SharedGalleryImpl( + SharedGalleryInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String location() { + return this.innerModel().location(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public SharedGalleryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharingUpdateImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharingUpdateImpl.java new file mode 100644 index 0000000000000..ddc7a5b2be62f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SharingUpdateImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroup; +import com.azure.resourcemanager.compute.generated.models.SharingUpdate; +import com.azure.resourcemanager.compute.generated.models.SharingUpdateOperationTypes; +import java.util.Collections; +import java.util.List; + +public final class SharingUpdateImpl implements SharingUpdate { + private SharingUpdateInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + SharingUpdateImpl( + SharingUpdateInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SharingUpdateOperationTypes operationType() { + return this.innerModel().operationType(); + } + + public List groups() { + List inner = this.innerModel().groups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SharingUpdateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotImpl.java new file mode 100644 index 0000000000000..da818b4b5b5ba --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotImpl.java @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskState; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionSettingsCollection; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.Snapshot; +import com.azure.resourcemanager.compute.generated.models.SnapshotSku; +import com.azure.resourcemanager.compute.generated.models.SnapshotUpdate; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class SnapshotImpl implements Snapshot, Snapshot.Definition, Snapshot.Update { + private SnapshotInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public SnapshotSku sku() { + return this.innerModel().sku(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public HyperVGeneration hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerModel().purchasePlan(); + } + + public SupportedCapabilities supportedCapabilities() { + return this.innerModel().supportedCapabilities(); + } + + public CreationData creationData() { + return this.innerModel().creationData(); + } + + public Integer diskSizeGB() { + return this.innerModel().diskSizeGB(); + } + + public Long diskSizeBytes() { + return this.innerModel().diskSizeBytes(); + } + + public DiskState diskState() { + return this.innerModel().diskState(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerModel().encryptionSettingsCollection(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Boolean incremental() { + return this.innerModel().incremental(); + } + + public Encryption encryption() { + return this.innerModel().encryption(); + } + + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerModel().networkAccessPolicy(); + } + + public String diskAccessId() { + return this.innerModel().diskAccessId(); + } + + public DiskSecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public Boolean supportsHibernation() { + return this.innerModel().supportsHibernation(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Float completionPercent() { + return this.innerModel().completionPercent(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SnapshotInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String snapshotName; + + private SnapshotUpdate updateSnapshot; + + public SnapshotImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Snapshot create() { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .createOrUpdate(resourceGroupName, snapshotName, this.innerModel(), Context.NONE); + return this; + } + + public Snapshot create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .createOrUpdate(resourceGroupName, snapshotName, this.innerModel(), context); + return this; + } + + SnapshotImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new SnapshotInner(); + this.serviceManager = serviceManager; + this.snapshotName = name; + } + + public SnapshotImpl update() { + this.updateSnapshot = new SnapshotUpdate(); + return this; + } + + public Snapshot apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .update(resourceGroupName, snapshotName, updateSnapshot, Context.NONE); + return this; + } + + public Snapshot apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .update(resourceGroupName, snapshotName, updateSnapshot, context); + return this; + } + + SnapshotImpl(SnapshotInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.snapshotName = Utils.getValueFromIdByName(innerObject.id(), "snapshots"); + } + + public Snapshot refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .getByResourceGroupWithResponse(resourceGroupName, snapshotName, Context.NONE) + .getValue(); + return this; + } + + public Snapshot refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSnapshots() + .getByResourceGroupWithResponse(resourceGroupName, snapshotName, context) + .getValue(); + return this; + } + + public AccessUri grantAccess(GrantAccessData grantAccessData) { + return serviceManager.snapshots().grantAccess(resourceGroupName, snapshotName, grantAccessData); + } + + public AccessUri grantAccess(GrantAccessData grantAccessData, Context context) { + return serviceManager.snapshots().grantAccess(resourceGroupName, snapshotName, grantAccessData, context); + } + + public void revokeAccess() { + serviceManager.snapshots().revokeAccess(resourceGroupName, snapshotName); + } + + public void revokeAccess(Context context) { + serviceManager.snapshots().revokeAccess(resourceGroupName, snapshotName, context); + } + + public SnapshotImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SnapshotImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SnapshotImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSnapshot.withTags(tags); + return this; + } + } + + public SnapshotImpl withSku(SnapshotSku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateSnapshot.withSku(sku); + return this; + } + } + + public SnapshotImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public SnapshotImpl withOsType(OperatingSystemTypes osType) { + if (isInCreateMode()) { + this.innerModel().withOsType(osType); + return this; + } else { + this.updateSnapshot.withOsType(osType); + return this; + } + } + + public SnapshotImpl withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.innerModel().withHyperVGeneration(hyperVGeneration); + return this; + } + + public SnapshotImpl withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + this.innerModel().withPurchasePlan(purchasePlan); + return this; + } + + public SnapshotImpl withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (isInCreateMode()) { + this.innerModel().withSupportedCapabilities(supportedCapabilities); + return this; + } else { + this.updateSnapshot.withSupportedCapabilities(supportedCapabilities); + return this; + } + } + + public SnapshotImpl withCreationData(CreationData creationData) { + this.innerModel().withCreationData(creationData); + return this; + } + + public SnapshotImpl withDiskSizeGB(Integer diskSizeGB) { + if (isInCreateMode()) { + this.innerModel().withDiskSizeGB(diskSizeGB); + return this; + } else { + this.updateSnapshot.withDiskSizeGB(diskSizeGB); + return this; + } + } + + public SnapshotImpl withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (isInCreateMode()) { + this.innerModel().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } else { + this.updateSnapshot.withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + } + + public SnapshotImpl withIncremental(Boolean incremental) { + this.innerModel().withIncremental(incremental); + return this; + } + + public SnapshotImpl withEncryption(Encryption encryption) { + if (isInCreateMode()) { + this.innerModel().withEncryption(encryption); + return this; + } else { + this.updateSnapshot.withEncryption(encryption); + return this; + } + } + + public SnapshotImpl withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (isInCreateMode()) { + this.innerModel().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } else { + this.updateSnapshot.withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + } + + public SnapshotImpl withDiskAccessId(String diskAccessId) { + if (isInCreateMode()) { + this.innerModel().withDiskAccessId(diskAccessId); + return this; + } else { + this.updateSnapshot.withDiskAccessId(diskAccessId); + return this; + } + } + + public SnapshotImpl withSecurityProfile(DiskSecurityProfile securityProfile) { + this.innerModel().withSecurityProfile(securityProfile); + return this; + } + + public SnapshotImpl withSupportsHibernation(Boolean supportsHibernation) { + if (isInCreateMode()) { + this.innerModel().withSupportsHibernation(supportsHibernation); + return this; + } else { + this.updateSnapshot.withSupportsHibernation(supportsHibernation); + return this; + } + } + + public SnapshotImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateSnapshot.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public SnapshotImpl withCompletionPercent(Float completionPercent) { + this.innerModel().withCompletionPercent(completionPercent); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsClientImpl.java new file mode 100644 index 0000000000000..2c083b968b7d4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsClientImpl.java @@ -0,0 +1,2176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.SnapshotsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.azure.resourcemanager.compute.generated.models.SnapshotList; +import com.azure.resourcemanager.compute.generated.models.SnapshotUpdate; +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 SnapshotsClient. */ +public final class SnapshotsClientImpl implements SnapshotsClient { + private final ClientLogger logger = new ClientLogger(SnapshotsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SnapshotsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of SnapshotsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SnapshotsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(SnapshotsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientSnapshots to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface SnapshotsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SnapshotInner snapshot, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SnapshotUpdate snapshot, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}/beginGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> grantAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GrantAccessData grantAccessData, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + + "/{snapshotName}/endGetAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revokeAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("snapshotName") String snapshotName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (snapshot == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null.")); + } else { + snapshot.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + snapshot, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (snapshot == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null.")); + } else { + snapshot.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + snapshot, + accept, + context); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SnapshotInner> beginCreateOrUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SnapshotInner.class, + SnapshotInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SnapshotInner> beginCreateOrUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, context); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SnapshotInner> beginCreateOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot) { + return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot).getSyncPoller(); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SnapshotInner> beginCreateOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context).getSyncPoller(); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot) { + return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { + return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot).block(); + } + + /** + * Creates or updates a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Put disk operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SnapshotInner createOrUpdate( + String resourceGroupName, String snapshotName, SnapshotInner snapshot, Context context) { + return createOrUpdateAsync(resourceGroupName, snapshotName, snapshot, context).block(); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (snapshot == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null.")); + } else { + snapshot.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + snapshot, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (snapshot == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshot is required and cannot be null.")); + } else { + snapshot.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + snapshot, + accept, + context); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SnapshotInner> beginUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, snapshotName, snapshot); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SnapshotInner.class, + SnapshotInner.class, + this.client.getContext()); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SnapshotInner> beginUpdateAsync( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, snapshotName, snapshot, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SnapshotInner.class, SnapshotInner.class, context); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SnapshotInner> beginUpdate( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { + return beginUpdateAsync(resourceGroupName, snapshotName, snapshot).getSyncPoller(); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SnapshotInner> beginUpdate( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) { + return beginUpdateAsync(resourceGroupName, snapshotName, snapshot, context).getSyncPoller(); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { + return beginUpdateAsync(resourceGroupName, snapshotName, snapshot) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) { + return beginUpdateAsync(resourceGroupName, snapshotName, snapshot, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SnapshotInner update(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { + return updateAsync(resourceGroupName, snapshotName, snapshot).block(); + } + + /** + * Updates (patches) a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return snapshot resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SnapshotInner update( + String resourceGroupName, String snapshotName, SnapshotUpdate snapshot, Context context) { + return updateAsync(resourceGroupName, snapshotName, snapshot, context).block(); + } + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String snapshotName) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String snapshotName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + accept, + context); + } + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String snapshotName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) { + return getByResourceGroupAsync(resourceGroupName, snapshotName).block(); + } + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String snapshotName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, snapshotName, context).block(); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 snapshotName) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 snapshotName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + context); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String snapshotName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String snapshotName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, snapshotName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String snapshotName) { + return beginDeleteAsync(resourceGroupName, snapshotName).getSyncPoller(); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String snapshotName, Context context) { + return beginDeleteAsync(resourceGroupName, snapshotName, context).getSyncPoller(); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 snapshotName) { + return beginDeleteAsync(resourceGroupName, snapshotName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 snapshotName, Context context) { + return beginDeleteAsync(resourceGroupName, snapshotName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 snapshotName) { + deleteAsync(resourceGroupName, snapshotName).block(); + } + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 snapshotName, Context context) { + deleteAsync(resourceGroupName, snapshotName, context).block(); + } + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + 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 snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists snapshots under 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 the List Snapshots operation response 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 apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, 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 snapshots under 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 the List Snapshots operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + grantAccessData, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> grantAccessWithResponseAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + if (grantAccessData == null) { + return Mono + .error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null.")); + } else { + grantAccessData.validate(); + } + final String apiVersion = "2021-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .grantAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + grantAccessData, + accept, + context); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + Mono>> mono = + grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccessUriInner.class, + AccessUriInner.class, + this.client.getContext()); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessUriInner> beginGrantAccessAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + grantAccessWithResponseAsync(resourceGroupName, snapshotName, grantAccessData, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccessUriInner.class, AccessUriInner.class, context); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData).getSyncPoller(); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessUriInner> beginGrantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context).getSyncPoller(); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono grantAccessAsync( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + return beginGrantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + return grantAccessAsync(resourceGroupName, snapshotName, grantAccessData).block(); + } + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessUriInner grantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + return grantAccessAsync(resourceGroupName, snapshotName, grantAccessData, context).block(); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revokeAccessWithResponseAsync( + String resourceGroupName, String snapshotName) { + 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 (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + return FluxUtil + .withContext( + context -> + service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revokeAccessWithResponseAsync( + String resourceGroupName, String snapshotName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (snapshotName == null) { + return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null.")); + } + final String apiVersion = "2021-08-01"; + context = this.client.mergeContext(context); + return service + .revokeAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + snapshotName, + apiVersion, + context); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String snapshotName) { + Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevokeAccessAsync( + String resourceGroupName, String snapshotName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, snapshotName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String snapshotName) { + return beginRevokeAccessAsync(resourceGroupName, snapshotName).getSyncPoller(); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevokeAccess( + String resourceGroupName, String snapshotName, Context context) { + return beginRevokeAccessAsync(resourceGroupName, snapshotName, context).getSyncPoller(); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revokeAccessAsync(String resourceGroupName, String snapshotName) { + return beginRevokeAccessAsync(resourceGroupName, snapshotName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revokeAccessAsync(String resourceGroupName, String snapshotName, Context context) { + return beginRevokeAccessAsync(resourceGroupName, snapshotName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revokeAccess(String resourceGroupName, String snapshotName) { + revokeAccessAsync(resourceGroupName, snapshotName).block(); + } + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revokeAccess(String resourceGroupName, String snapshotName, Context context) { + revokeAccessAsync(resourceGroupName, snapshotName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Snapshots operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Snapshots operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Snapshots operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Snapshots operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsImpl.java new file mode 100644 index 0000000000000..1b7d6e7920505 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SnapshotsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.SnapshotsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import com.azure.resourcemanager.compute.generated.models.AccessUri; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; +import com.azure.resourcemanager.compute.generated.models.Snapshot; +import com.azure.resourcemanager.compute.generated.models.Snapshots; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SnapshotsImpl implements Snapshots { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotsImpl.class); + + private final SnapshotsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public SnapshotsImpl( + SnapshotsClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Snapshot getByResourceGroup(String resourceGroupName, String snapshotName) { + SnapshotInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, snapshotName); + if (inner != null) { + return new SnapshotImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String snapshotName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, snapshotName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SnapshotImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String snapshotName) { + this.serviceClient().delete(resourceGroupName, snapshotName); + } + + public void delete(String resourceGroupName, String snapshotName, Context context) { + this.serviceClient().delete(resourceGroupName, snapshotName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SnapshotImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SnapshotImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SnapshotImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SnapshotImpl(inner1, this.manager())); + } + + public AccessUri grantAccess(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData) { + AccessUriInner inner = this.serviceClient().grantAccess(resourceGroupName, snapshotName, grantAccessData); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public AccessUri grantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context) { + AccessUriInner inner = + this.serviceClient().grantAccess(resourceGroupName, snapshotName, grantAccessData, context); + if (inner != null) { + return new AccessUriImpl(inner, this.manager()); + } else { + return null; + } + } + + public void revokeAccess(String resourceGroupName, String snapshotName) { + this.serviceClient().revokeAccess(resourceGroupName, snapshotName); + } + + public void revokeAccess(String resourceGroupName, String snapshotName, Context context) { + this.serviceClient().revokeAccess(resourceGroupName, snapshotName, context); + } + + public Snapshot getById(String id) { + String resourceGroupName = Utils.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 snapshotName = Utils.getValueFromIdByName(id, "snapshots"); + if (snapshotName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'snapshots'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, snapshotName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 snapshotName = Utils.getValueFromIdByName(id, "snapshots"); + if (snapshotName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'snapshots'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, snapshotName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 snapshotName = Utils.getValueFromIdByName(id, "snapshots"); + if (snapshotName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'snapshots'.", id))); + } + this.delete(resourceGroupName, snapshotName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 snapshotName = Utils.getValueFromIdByName(id, "snapshots"); + if (snapshotName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'snapshots'.", id))); + } + this.delete(resourceGroupName, snapshotName, context); + } + + private SnapshotsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public SnapshotImpl define(String name) { + return new SnapshotImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyGenerateKeyPairResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyGenerateKeyPairResultImpl.java new file mode 100644 index 0000000000000..eb21ad810febf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyGenerateKeyPairResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyGenerateKeyPairResult; + +public final class SshPublicKeyGenerateKeyPairResultImpl implements SshPublicKeyGenerateKeyPairResult { + private SshPublicKeyGenerateKeyPairResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + SshPublicKeyGenerateKeyPairResultImpl( + SshPublicKeyGenerateKeyPairResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String privateKey() { + return this.innerModel().privateKey(); + } + + public String publicKey() { + return this.innerModel().publicKey(); + } + + public String id() { + return this.innerModel().id(); + } + + public SshPublicKeyGenerateKeyPairResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyResourceImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyResourceImpl.java new file mode 100644 index 0000000000000..2f70181303fae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeyResourceImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyGenerateKeyPairResult; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyResource; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyUpdateResource; +import java.util.Collections; +import java.util.Map; + +public final class SshPublicKeyResourceImpl + implements SshPublicKeyResource, SshPublicKeyResource.Definition, SshPublicKeyResource.Update { + private SshPublicKeyResourceInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String publicKey() { + return this.innerModel().publicKey(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SshPublicKeyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sshPublicKeyName; + + private SshPublicKeyUpdateResource updateParameters; + + public SshPublicKeyResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SshPublicKeyResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .createWithResponse(resourceGroupName, sshPublicKeyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SshPublicKeyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .createWithResponse(resourceGroupName, sshPublicKeyName, this.innerModel(), context) + .getValue(); + return this; + } + + SshPublicKeyResourceImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new SshPublicKeyResourceInner(); + this.serviceManager = serviceManager; + this.sshPublicKeyName = name; + } + + public SshPublicKeyResourceImpl update() { + this.updateParameters = new SshPublicKeyUpdateResource(); + return this; + } + + public SshPublicKeyResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .updateWithResponse(resourceGroupName, sshPublicKeyName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SshPublicKeyResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .updateWithResponse(resourceGroupName, sshPublicKeyName, updateParameters, context) + .getValue(); + return this; + } + + SshPublicKeyResourceImpl( + SshPublicKeyResourceInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sshPublicKeyName = Utils.getValueFromIdByName(innerObject.id(), "sshPublicKeys"); + } + + public SshPublicKeyResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .getByResourceGroupWithResponse(resourceGroupName, sshPublicKeyName, Context.NONE) + .getValue(); + return this; + } + + public SshPublicKeyResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSshPublicKeys() + .getByResourceGroupWithResponse(resourceGroupName, sshPublicKeyName, context) + .getValue(); + return this; + } + + public SshPublicKeyGenerateKeyPairResult generateKeyPair() { + return serviceManager.sshPublicKeys().generateKeyPair(resourceGroupName, sshPublicKeyName); + } + + public Response generateKeyPairWithResponse(Context context) { + return serviceManager.sshPublicKeys().generateKeyPairWithResponse(resourceGroupName, sshPublicKeyName, context); + } + + public SshPublicKeyResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SshPublicKeyResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SshPublicKeyResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SshPublicKeyResourceImpl withPublicKey(String publicKey) { + if (isInCreateMode()) { + this.innerModel().withPublicKey(publicKey); + return this; + } else { + this.updateParameters.withPublicKey(publicKey); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysClientImpl.java new file mode 100644 index 0000000000000..bf1f4ff164c1c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysClientImpl.java @@ -0,0 +1,1463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.SshPublicKeysClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyUpdateResource; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeysGroupListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SshPublicKeysClient. */ +public final class SshPublicKeysClientImpl implements SshPublicKeysClient { + private final ClientLogger logger = new ClientLogger(SshPublicKeysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SshPublicKeysService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of SshPublicKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SshPublicKeysClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(SshPublicKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientSshPublicKeys to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface SshPublicKeysService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys/{sshPublicKeyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sshPublicKeyName") String sshPublicKeyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SshPublicKeyResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys/{sshPublicKeyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sshPublicKeyName") String sshPublicKeyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SshPublicKeyUpdateResource parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys/{sshPublicKeyName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sshPublicKeyName") String sshPublicKeyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys/{sshPublicKeyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sshPublicKeyName") String sshPublicKeyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/sshPublicKeys/{sshPublicKeyName}/generateKeyPair") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> generateKeyPair( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sshPublicKeyName") String sshPublicKeyName, + @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(ApiErrorException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters) { + return createWithResponseAsync(resourceGroupName, sshPublicKeyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SshPublicKeyResourceInner create( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters) { + return createAsync(resourceGroupName, sshPublicKeyName, parameters).block(); + } + + /** + * Creates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to create the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyResourceInner parameters, Context context) { + return createWithResponseAsync(resourceGroupName, sshPublicKeyName, parameters, context).block(); + } + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters) { + return updateWithResponseAsync(resourceGroupName, sshPublicKeyName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SshPublicKeyResourceInner update( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters) { + return updateAsync(resourceGroupName, sshPublicKeyName, parameters).block(); + } + + /** + * Updates a new SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param parameters Parameters supplied to update the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String sshPublicKeyName, SshPublicKeyUpdateResource parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, sshPublicKeyName, parameters, context).block(); + } + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 sshPublicKeyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 sshPublicKeyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 sshPublicKeyName) { + return deleteWithResponseAsync(resourceGroupName, sshPublicKeyName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 sshPublicKeyName) { + deleteAsync(resourceGroupName, sshPublicKeyName).block(); + } + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String sshPublicKeyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, sshPublicKeyName, context).block(); + } + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sshPublicKeyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String sshPublicKeyName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sshPublicKeyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SshPublicKeyResourceInner getByResourceGroup(String resourceGroupName, String sshPublicKeyName) { + return getByResourceGroupAsync(resourceGroupName, sshPublicKeyName).block(); + } + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sshPublicKeyName, context).block(); + } + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyPairWithResponseAsync( + String resourceGroupName, String sshPublicKeyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateKeyPair( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyPairWithResponseAsync( + String resourceGroupName, String sshPublicKeyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sshPublicKeyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sshPublicKeyName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateKeyPair( + this.client.getEndpoint(), + resourceGroupName, + sshPublicKeyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateKeyPairAsync( + String resourceGroupName, String sshPublicKeyName) { + return generateKeyPairWithResponseAsync(resourceGroupName, sshPublicKeyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SshPublicKeyGenerateKeyPairResultInner generateKeyPair(String resourceGroupName, String sshPublicKeyName) { + return generateKeyPairAsync(resourceGroupName, sshPublicKeyName).block(); + } + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateKeyPairWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context) { + return generateKeyPairWithResponseAsync(resourceGroupName, sshPublicKeyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysImpl.java new file mode 100644 index 0000000000000..d191325797aa5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/SshPublicKeysImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.SshPublicKeysClient; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyGenerateKeyPairResult; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyResource; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeys; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SshPublicKeysImpl implements SshPublicKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeysImpl.class); + + private final SshPublicKeysClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public SshPublicKeysImpl( + SshPublicKeysClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SshPublicKeyResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SshPublicKeyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SshPublicKeyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SshPublicKeyResourceImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceGroupName, String sshPublicKeyName) { + this.serviceClient().delete(resourceGroupName, sshPublicKeyName); + } + + public Response deleteWithResponse(String resourceGroupName, String sshPublicKeyName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sshPublicKeyName, context); + } + + public SshPublicKeyResource getByResourceGroup(String resourceGroupName, String sshPublicKeyName) { + SshPublicKeyResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, sshPublicKeyName); + if (inner != null) { + return new SshPublicKeyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sshPublicKeyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SshPublicKeyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SshPublicKeyGenerateKeyPairResult generateKeyPair(String resourceGroupName, String sshPublicKeyName) { + SshPublicKeyGenerateKeyPairResultInner inner = + this.serviceClient().generateKeyPair(resourceGroupName, sshPublicKeyName); + if (inner != null) { + return new SshPublicKeyGenerateKeyPairResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateKeyPairWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context) { + Response inner = + this.serviceClient().generateKeyPairWithResponse(resourceGroupName, sshPublicKeyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SshPublicKeyGenerateKeyPairResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SshPublicKeyResource getById(String id) { + String resourceGroupName = Utils.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 sshPublicKeyName = Utils.getValueFromIdByName(id, "sshPublicKeys"); + if (sshPublicKeyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sshPublicKeys'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sshPublicKeyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 sshPublicKeyName = Utils.getValueFromIdByName(id, "sshPublicKeys"); + if (sshPublicKeyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sshPublicKeys'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sshPublicKeyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 sshPublicKeyName = Utils.getValueFromIdByName(id, "sshPublicKeys"); + if (sshPublicKeyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sshPublicKeys'.", id))); + } + this.deleteWithResponse(resourceGroupName, sshPublicKeyName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 sshPublicKeyName = Utils.getValueFromIdByName(id, "sshPublicKeys"); + if (sshPublicKeyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sshPublicKeys'.", id))); + } + return this.deleteWithResponse(resourceGroupName, sshPublicKeyName, context); + } + + private SshPublicKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public SshPublicKeyResourceImpl define(String name) { + return new SshPublicKeyResourceImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpdateDomainImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpdateDomainImpl.java new file mode 100644 index 0000000000000..5bee57378fa7e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpdateDomainImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner; +import com.azure.resourcemanager.compute.generated.models.UpdateDomain; + +public final class UpdateDomainImpl implements UpdateDomain { + private UpdateDomainInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + UpdateDomainImpl( + UpdateDomainInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public UpdateDomainInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpgradeOperationHistoricalStatusInfoImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpgradeOperationHistoricalStatusInfoImpl.java new file mode 100644 index 0000000000000..54081979ebba3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UpgradeOperationHistoricalStatusInfoImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; +import com.azure.resourcemanager.compute.generated.models.UpgradeOperationHistoricalStatusInfo; +import com.azure.resourcemanager.compute.generated.models.UpgradeOperationHistoricalStatusInfoProperties; + +public final class UpgradeOperationHistoricalStatusInfoImpl implements UpgradeOperationHistoricalStatusInfo { + private UpgradeOperationHistoricalStatusInfoInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + UpgradeOperationHistoricalStatusInfoImpl( + UpgradeOperationHistoricalStatusInfoInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UpgradeOperationHistoricalStatusInfoProperties properties() { + return this.innerModel().properties(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public UpgradeOperationHistoricalStatusInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsageImpl.java new file mode 100644 index 0000000000000..96124976a1abb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsageImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.compute.generated.models.Usage; +import com.azure.resourcemanager.compute.generated.models.UsageName; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + UsageImpl(UsageInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String unit() { + return this.innerModel().unit(); + } + + public int currentValue() { + return this.innerModel().currentValue(); + } + + public long limit() { + return this.innerModel().limit(); + } + + public UsageName name() { + return this.innerModel().name(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesClientImpl.java new file mode 100644 index 0000000000000..20afb78dccd39 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesClientImpl.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.UsagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.ListUsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public final class UsagesClientImpl implements UsagesClient { + private final ClientLogger logger = new ClientLogger(UsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(ComputeManagementClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface UsagesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @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(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + location, + apiVersion, + 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, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location) { + return new PagedFlux<>(() -> listSinglePageAsync(location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location) { + return new PagedIterable<>(listAsync(location)); + } + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, Context context) { + return new PagedIterable<>(listAsync(location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..226c2925388fb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/UsagesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.UsagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.compute.generated.models.Usage; +import com.azure.resourcemanager.compute.generated.models.Usages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsagesImpl implements Usages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public UsagesImpl( + UsagesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, Context context) { + PagedIterable inner = this.serviceClient().list(location, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/Utils.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/Utils.java new file mode 100644 index 0000000000000..6fa3fae68aec2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineAssessPatchesResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineAssessPatchesResultImpl.java new file mode 100644 index 0000000000000..48d9f83dc7dc4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineAssessPatchesResultImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.PatchOperationStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAssessPatchesResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSoftwarePatchProperties; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineAssessPatchesResultImpl implements VirtualMachineAssessPatchesResult { + private VirtualMachineAssessPatchesResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineAssessPatchesResultImpl( + VirtualMachineAssessPatchesResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public PatchOperationStatus status() { + return this.innerModel().status(); + } + + public String assessmentActivityId() { + return this.innerModel().assessmentActivityId(); + } + + public Boolean rebootPending() { + return this.innerModel().rebootPending(); + } + + public Integer criticalAndSecurityPatchCount() { + return this.innerModel().criticalAndSecurityPatchCount(); + } + + public Integer otherPatchCount() { + return this.innerModel().otherPatchCount(); + } + + public OffsetDateTime startDateTime() { + return this.innerModel().startDateTime(); + } + + public List availablePatches() { + List inner = this.innerModel().availablePatches(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApiError error() { + return this.innerModel().error(); + } + + public VirtualMachineAssessPatchesResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineCaptureResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineCaptureResultImpl.java new file mode 100644 index 0000000000000..885cb878a37a5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineCaptureResultImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureResult; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineCaptureResultImpl implements VirtualMachineCaptureResult { + private VirtualMachineCaptureResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineCaptureResultImpl( + VirtualMachineCaptureResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public String contentVersion() { + return this.innerModel().contentVersion(); + } + + public Object parameters() { + return this.innerModel().parameters(); + } + + public List resources() { + List inner = this.innerModel().resources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineCaptureResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImageImpl.java new file mode 100644 index 0000000000000..d363a83b1f456 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImageImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionImageInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionImage; +import java.util.Collections; +import java.util.Map; + +public final class VirtualMachineExtensionImageImpl implements VirtualMachineExtensionImage { + private VirtualMachineExtensionImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineExtensionImageImpl( + VirtualMachineExtensionImageInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager 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 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 String operatingSystem() { + return this.innerModel().operatingSystem(); + } + + public String computeRole() { + return this.innerModel().computeRole(); + } + + public String handlerSchema() { + return this.innerModel().handlerSchema(); + } + + public Boolean vmScaleSetEnabled() { + return this.innerModel().vmScaleSetEnabled(); + } + + public Boolean supportsMultipleExtensions() { + return this.innerModel().supportsMultipleExtensions(); + } + + public VirtualMachineExtensionImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesClientImpl.java new file mode 100644 index 0000000000000..e0190feed613e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesClientImpl.java @@ -0,0 +1,666 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineExtensionImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionImageInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineExtensionImagesClient. */ +public final class VirtualMachineExtensionImagesClientImpl implements VirtualMachineExtensionImagesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineExtensionImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineExtensionImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineExtensionImagesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineExtensionImagesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineExtensionImages to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineExtensionImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @PathParam("type") String type, + @PathParam("version") String version, + @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.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmextension/types") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listTypes( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @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.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmextension/types/{type}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listVersions( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @PathParam("type") String type, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 extension image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publisherName, String type, String version) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + publisherName, + type, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 extension image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publisherName, String type, String version, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + location, + publisherName, + type, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 extension image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String publisherName, String type, String version) { + return getWithResponseAsync(location, publisherName, type, version) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 extension image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionImageInner get(String location, String publisherName, String type, String version) { + return getAsync(location, publisherName, type, version).block(); + } + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 extension image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, String publisherName, String type, String version, Context context) { + return getWithResponseAsync(location, publisherName, type, version, context).block(); + } + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listTypesWithResponseAsync( + String location, String publisherName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTypes( + this.client.getEndpoint(), + location, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listTypesWithResponseAsync( + String location, String publisherName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTypes( + this.client.getEndpoint(), + location, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTypesAsync(String location, String publisherName) { + return listTypesWithResponseAsync(location, publisherName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listTypes(String location, String publisherName) { + return listTypesAsync(location, publisherName).block(); + } + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listTypesWithResponse( + String location, String publisherName, Context context) { + return listTypesWithResponseAsync(location, publisherName, context).block(); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listVersionsWithResponseAsync( + String location, String publisherName, String type, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listVersions( + this.client.getEndpoint(), + location, + publisherName, + type, + filter, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listVersionsWithResponseAsync( + String location, + String publisherName, + String type, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listVersions( + this.client.getEndpoint(), + location, + publisherName, + type, + filter, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsAsync( + String location, String publisherName, String type, String filter, Integer top, String orderby) { + return listVersionsWithResponseAsync(location, publisherName, type, filter, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsAsync( + String location, String publisherName, String type) { + final String filter = null; + final Integer top = null; + final String orderby = null; + return listVersionsWithResponseAsync(location, publisherName, type, filter, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listVersions(String location, String publisherName, String type) { + final String filter = null; + final Integer top = null; + final String orderby = null; + return listVersionsAsync(location, publisherName, type, filter, top, orderby).block(); + } + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listVersionsWithResponse( + String location, + String publisherName, + String type, + String filter, + Integer top, + String orderby, + Context context) { + return listVersionsWithResponseAsync(location, publisherName, type, filter, top, orderby, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesImpl.java new file mode 100644 index 0000000000000..b159339561b7f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImagesImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineExtensionImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionImageInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionImage; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionImages; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class VirtualMachineExtensionImagesImpl implements VirtualMachineExtensionImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionImagesImpl.class); + + private final VirtualMachineExtensionImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineExtensionImagesImpl( + VirtualMachineExtensionImagesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachineExtensionImage get(String location, String publisherName, String type, String version) { + VirtualMachineExtensionImageInner inner = this.serviceClient().get(location, publisherName, type, version); + if (inner != null) { + return new VirtualMachineExtensionImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, String publisherName, String type, String version, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, publisherName, type, version, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineExtensionImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List listTypes(String location, String publisherName) { + List inner = this.serviceClient().listTypes(location, publisherName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineExtensionImageImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listTypesWithResponse( + String location, String publisherName, Context context) { + Response> inner = + this.serviceClient().listTypesWithResponse(location, publisherName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineExtensionImageImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listVersions(String location, String publisherName, String type) { + List inner = + this.serviceClient().listVersions(location, publisherName, type); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineExtensionImageImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listVersionsWithResponse( + String location, + String publisherName, + String type, + String filter, + Integer top, + String orderby, + Context context) { + Response> inner = + this.serviceClient().listVersionsWithResponse(location, publisherName, type, filter, top, orderby, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineExtensionImageImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + private VirtualMachineExtensionImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImpl.java new file mode 100644 index 0000000000000..5c75e97c0e501 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionUpdate; +import java.util.Collections; +import java.util.Map; + +public final class VirtualMachineExtensionImpl + implements VirtualMachineExtension, VirtualMachineExtension.Definition, VirtualMachineExtension.Update { + private VirtualMachineExtensionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 String forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String typeHandlerVersion() { + return this.innerModel().typeHandlerVersion(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public Boolean enableAutomaticUpgrade() { + return this.innerModel().enableAutomaticUpgrade(); + } + + public Object settings() { + return this.innerModel().settings(); + } + + public Object protectedSettings() { + return this.innerModel().protectedSettings(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineExtensionInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Boolean suppressFailures() { + return this.innerModel().suppressFailures(); + } + + public Object protectedSettingsFromKeyVault() { + return this.innerModel().protectedSettingsFromKeyVault(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineExtensionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmName; + + private String vmExtensionName; + + private VirtualMachineExtensionUpdate updateExtensionParameters; + + public VirtualMachineExtensionImpl withExistingVirtualMachine(String resourceGroupName, String vmName) { + this.resourceGroupName = resourceGroupName; + this.vmName = vmName; + return this; + } + + public VirtualMachineExtension create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .createOrUpdate(resourceGroupName, vmName, vmExtensionName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineExtension create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .createOrUpdate(resourceGroupName, vmName, vmExtensionName, this.innerModel(), context); + return this; + } + + VirtualMachineExtensionImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineExtensionInner(); + this.serviceManager = serviceManager; + this.vmExtensionName = name; + } + + public VirtualMachineExtensionImpl update() { + this.updateExtensionParameters = new VirtualMachineExtensionUpdate(); + return this; + } + + public VirtualMachineExtension apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .update(resourceGroupName, vmName, vmExtensionName, updateExtensionParameters, Context.NONE); + return this; + } + + public VirtualMachineExtension apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .update(resourceGroupName, vmName, vmExtensionName, updateExtensionParameters, context); + return this; + } + + VirtualMachineExtensionImpl( + VirtualMachineExtensionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + this.vmExtensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public VirtualMachineExtension refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .getWithResponse(resourceGroupName, vmName, vmExtensionName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineExtension refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineExtensions() + .getWithResponse(resourceGroupName, vmName, vmExtensionName, localExpand, context) + .getValue(); + return this; + } + + public VirtualMachineExtensionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineExtensionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineExtensionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateExtensionParameters.withTags(tags); + return this; + } + } + + public VirtualMachineExtensionImpl withForceUpdateTag(String forceUpdateTag) { + if (isInCreateMode()) { + this.innerModel().withForceUpdateTag(forceUpdateTag); + return this; + } else { + this.updateExtensionParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + } + + public VirtualMachineExtensionImpl withPublisher(String publisher) { + if (isInCreateMode()) { + this.innerModel().withPublisher(publisher); + return this; + } else { + this.updateExtensionParameters.withPublisher(publisher); + return this; + } + } + + public VirtualMachineExtensionImpl withTypePropertiesType(String typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public VirtualMachineExtensionImpl withTypeHandlerVersion(String typeHandlerVersion) { + if (isInCreateMode()) { + this.innerModel().withTypeHandlerVersion(typeHandlerVersion); + return this; + } else { + this.updateExtensionParameters.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + } + + public VirtualMachineExtensionImpl withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (isInCreateMode()) { + this.innerModel().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } else { + this.updateExtensionParameters.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + } + + public VirtualMachineExtensionImpl withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (isInCreateMode()) { + this.innerModel().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } else { + this.updateExtensionParameters.withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + } + + public VirtualMachineExtensionImpl withSettings(Object settings) { + if (isInCreateMode()) { + this.innerModel().withSettings(settings); + return this; + } else { + this.updateExtensionParameters.withSettings(settings); + return this; + } + } + + public VirtualMachineExtensionImpl withProtectedSettings(Object protectedSettings) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettings(protectedSettings); + return this; + } else { + this.updateExtensionParameters.withProtectedSettings(protectedSettings); + return this; + } + } + + public VirtualMachineExtensionImpl withInstanceView(VirtualMachineExtensionInstanceView instanceView) { + this.innerModel().withInstanceView(instanceView); + return this; + } + + public VirtualMachineExtensionImpl withSuppressFailures(Boolean suppressFailures) { + if (isInCreateMode()) { + this.innerModel().withSuppressFailures(suppressFailures); + return this; + } else { + this.updateExtensionParameters.withSuppressFailures(suppressFailures); + return this; + } + } + + public VirtualMachineExtensionImpl withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } else { + this.updateExtensionParameters.withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + } + + public VirtualMachineExtensionImpl withType(String type) { + this.updateExtensionParameters.withType(type); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsClientImpl.java new file mode 100644 index 0000000000000..617e9469b8d12 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsClientImpl.java @@ -0,0 +1,1469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.polling.PollResult; +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.compute.generated.fluent.VirtualMachineExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionUpdate; +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 VirtualMachineExtensionsClient. */ +public final class VirtualMachineExtensionsClientImpl implements VirtualMachineExtensionsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineExtensionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineExtensionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineExtensionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineExtensions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineExtensionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/extensions/{vmExtensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineExtensionInner extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/extensions/{vmExtensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineExtensionUpdate extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/extensions/{vmExtensionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/extensions/{vmExtensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineExtensionInner.class, + VirtualMachineExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineExtensionInner.class, + VirtualMachineExtensionInner.class, + context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters) + .getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionInner createOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters) { + return createOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).block(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionInner createOrUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionInner extensionParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineExtensionInner> beginUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineExtensionInner.class, + VirtualMachineExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineExtensionInner> beginUpdateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineExtensionInner.class, + VirtualMachineExtensionInner.class, + context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineExtensionInner> beginUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineExtensionInner> beginUpdate( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionInner update( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters) { + return updateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionInner update( + String resourceGroupName, + String vmName, + String vmExtensionName, + VirtualMachineExtensionUpdate extensionParameters, + Context context) { + return updateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, String vmExtensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, String vmExtensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, String vmExtensionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vmName, vmExtensionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, String vmExtensionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmName, vmExtensionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String vmExtensionName) { + return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String vmExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName, context).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String vmExtensionName) { + return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String vmExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String vmExtensionName) { + deleteAsync(resourceGroupName, vmName, vmExtensionName).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String vmExtensionName, Context context) { + deleteAsync(resourceGroupName, vmName, vmExtensionName, context).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmName, String vmExtensionName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmName, + vmExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmName, String vmExtensionName, String expand) { + return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmName, String vmExtensionName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionInner get(String resourceGroupName, String vmName, String vmExtensionName) { + final String expand = null; + return getAsync(resourceGroupName, vmName, vmExtensionName, expand).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand, context).block(); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String vmName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String vmName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync( + String resourceGroupName, String vmName, String expand) { + return listWithResponseAsync(resourceGroupName, vmName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String vmName) { + final String expand = null; + return listWithResponseAsync(resourceGroupName, vmName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineExtensionsListResultInner list(String resourceGroupName, String vmName) { + final String expand = null; + return listAsync(resourceGroupName, vmName, expand).block(); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String vmName, String expand, Context context) { + return listWithResponseAsync(resourceGroupName, vmName, expand, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsImpl.java new file mode 100644 index 0000000000000..6083b8cb9624b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionsListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineExtensionsImpl implements VirtualMachineExtensions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionsImpl.class); + + private final VirtualMachineExtensionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineExtensionsImpl( + VirtualMachineExtensionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String vmName, String vmExtensionName) { + this.serviceClient().delete(resourceGroupName, vmName, vmExtensionName); + } + + public void delete(String resourceGroupName, String vmName, String vmExtensionName, Context context) { + this.serviceClient().delete(resourceGroupName, vmName, vmExtensionName, context); + } + + public VirtualMachineExtension get(String resourceGroupName, String vmName, String vmExtensionName) { + VirtualMachineExtensionInner inner = this.serviceClient().get(resourceGroupName, vmName, vmExtensionName); + if (inner != null) { + return new VirtualMachineExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vmName, vmExtensionName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineExtensionsListResult list(String resourceGroupName, String vmName) { + VirtualMachineExtensionsListResultInner inner = this.serviceClient().list(resourceGroupName, vmName); + if (inner != null) { + return new VirtualMachineExtensionsListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String vmName, String expand, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, vmName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineExtensionsListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineExtension getById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, vmName, vmExtensionName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, vmName, vmExtensionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmName, vmExtensionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmName, vmExtensionName, context); + } + + private VirtualMachineExtensionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineExtensionImpl define(String name) { + return new VirtualMachineExtensionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsListResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsListResultImpl.java new file mode 100644 index 0000000000000..ffdfee4c36d6c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineExtensionsListResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionsListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class VirtualMachineExtensionsListResultImpl implements VirtualMachineExtensionsListResult { + private VirtualMachineExtensionsListResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineExtensionsListResultImpl( + VirtualMachineExtensionsListResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineExtensionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineExtensionsListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageImpl.java new file mode 100644 index 0000000000000..dd946463d05fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageImpl.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.models.AutomaticOSUpgradeProperties; +import com.azure.resourcemanager.compute.generated.models.DataDiskImage; +import com.azure.resourcemanager.compute.generated.models.DisallowedConfiguration; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.OSDiskImage; +import com.azure.resourcemanager.compute.generated.models.PurchasePlan; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImage; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageFeature; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineImageImpl implements VirtualMachineImage { + private VirtualMachineImageInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineImageImpl( + VirtualMachineImageInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + 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 ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public PurchasePlan plan() { + return this.innerModel().plan(); + } + + public OSDiskImage osDiskImage() { + return this.innerModel().osDiskImage(); + } + + public List dataDiskImages() { + List inner = this.innerModel().dataDiskImages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public AutomaticOSUpgradeProperties automaticOSUpgradeProperties() { + return this.innerModel().automaticOSUpgradeProperties(); + } + + public HyperVGenerationTypes hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public DisallowedConfiguration disallowed() { + return this.innerModel().disallowed(); + } + + public List features() { + List inner = this.innerModel().features(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageResourceImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageResourceImpl.java new file mode 100644 index 0000000000000..773badd540a12 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImageResourceImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageResource; +import java.util.Collections; +import java.util.Map; + +public final class VirtualMachineImageResourceImpl implements VirtualMachineImageResource { + private VirtualMachineImageResourceInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineImageResourceImpl( + VirtualMachineImageResourceInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + 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 ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public VirtualMachineImageResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesClientImpl.java new file mode 100644 index 0000000000000..b5e6117ed6972 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesClientImpl.java @@ -0,0 +1,1030 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImagesClient. */ +public final class VirtualMachineImagesClientImpl implements VirtualMachineImagesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineImagesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineImagesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineImages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @PathParam("skus") String skus, + @PathParam("version") String version, + @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.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @PathParam("skus") String skus, + @QueryParam("$expand") String expand, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @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.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmimage/offers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listOffers( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @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.Compute/locations/{location}/publishers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listPublishers( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @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.Compute/locations/{location}/publishers" + + "/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listSkus( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publisherName, String offer, String skus, String version) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + publisherName, + offer, + skus, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String publisherName, String offer, String skus, String version, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + location, + publisherName, + offer, + skus, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String publisherName, String offer, String skus, String version) { + return getWithResponseAsync(location, publisherName, offer, skus, version) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineImageInner get( + String location, String publisherName, String offer, String skus, String version) { + return getAsync(location, publisherName, offer, skus, version).block(); + } + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, String publisherName, String offer, String skus, String version, Context context) { + return getWithResponseAsync(location, publisherName, offer, skus, version, context).block(); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String location, String publisherName, String offer, String skus, String expand, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + location, + publisherName, + offer, + skus, + expand, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String location, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + location, + publisherName, + offer, + skus, + expand, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync( + String location, String publisherName, String offer, String skus, String expand, Integer top, String orderby) { + return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync( + String location, String publisherName, String offer, String skus) { + final String expand = null; + final Integer top = null; + final String orderby = null; + return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list( + String location, String publisherName, String offer, String skus) { + final String expand = null; + final Integer top = null; + final String orderby = null; + return listAsync(location, publisherName, offer, skus, expand, top, orderby).block(); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String location, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + return listWithResponseAsync(location, publisherName, offer, skus, expand, top, orderby, context).block(); + } + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listOffersWithResponseAsync( + String location, String publisherName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listOffers( + this.client.getEndpoint(), + location, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listOffersWithResponseAsync( + String location, String publisherName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOffers( + this.client.getEndpoint(), + location, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOffersAsync(String location, String publisherName) { + return listOffersWithResponseAsync(location, publisherName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listOffers(String location, String publisherName) { + return listOffersAsync(location, publisherName).block(); + } + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listOffersWithResponse( + String location, String publisherName, Context context) { + return listOffersWithResponseAsync(location, publisherName, context).block(); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPublishersWithResponseAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPublishers( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPublishersWithResponseAsync( + String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPublishers( + this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPublishersAsync(String location) { + return listPublishersWithResponseAsync(location) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listPublishers(String location) { + return listPublishersAsync(location).block(); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listPublishersWithResponse( + String location, Context context) { + return listPublishersWithResponseAsync(location, context).block(); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listSkusWithResponseAsync( + String location, String publisherName, String offer) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSkus( + this.client.getEndpoint(), + location, + publisherName, + offer, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listSkusWithResponseAsync( + String location, String publisherName, String offer, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSkus( + this.client.getEndpoint(), + location, + publisherName, + offer, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusAsync( + String location, String publisherName, String offer) { + return listSkusWithResponseAsync(location, publisherName, offer) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listSkus(String location, String publisherName, String offer) { + return listSkusAsync(location, publisherName, offer).block(); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listSkusWithResponse( + String location, String publisherName, String offer, Context context) { + return listSkusWithResponseAsync(location, publisherName, offer, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesClientImpl.java new file mode 100644 index 0000000000000..262aeb53ebdb1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesClientImpl.java @@ -0,0 +1,1153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineImagesEdgeZonesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImagesEdgeZonesClient. */ +public final class VirtualMachineImagesEdgeZonesClientImpl implements VirtualMachineImagesEdgeZonesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineImagesEdgeZonesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineImagesEdgeZonesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineImagesEdgeZonesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineImagesEdgeZonesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineImagesEdgeZonesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineImagesEdgeZones to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineImagesEdgeZonesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}" + + "/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("edgeZone") String edgeZone, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @PathParam("skus") String skus, + @PathParam("version") String version, + @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.Compute/locations/{location}/edgeZones/{edgeZone}" + + "/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("edgeZone") String edgeZone, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @PathParam("skus") String skus, + @QueryParam("$expand") String expand, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @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.Compute/locations/{location}/edgeZones/{edgeZone}" + + "/publishers/{publisherName}/artifacttypes/vmimage/offers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listOffers( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("edgeZone") String edgeZone, + @PathParam("publisherName") String publisherName, + @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.Compute/locations/{location}/edgeZones/{edgeZone}" + + "/publishers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listPublishers( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("edgeZone") String edgeZone, + @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.Compute/locations/{location}/edgeZones/{edgeZone}" + + "/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> listSkus( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("edgeZone") String edgeZone, + @PathParam("publisherName") String publisherName, + @PathParam("offer") String offer, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image in an edge zone along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String edgeZone, String publisherName, String offer, String skus, String version) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + skus, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image in an edge zone along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String version, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus is required and cannot be null.")); + } + if (version == null) { + return Mono.error(new IllegalArgumentException("Parameter version 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + skus, + version, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image in an edge zone on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String location, String edgeZone, String publisherName, String offer, String skus, String version) { + return getWithResponseAsync(location, edgeZone, publisherName, offer, skus, version) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image in an edge zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineImageInner get( + String location, String edgeZone, String publisherName, String offer, String skus, String version) { + return getAsync(location, edgeZone, publisherName, offer, skus, version).block(); + } + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 image in an edge zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String version, + Context context) { + return getWithResponseAsync(location, edgeZone, publisherName, offer, skus, version, context).block(); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + skus, + expand, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer is required and cannot be null.")); + } + if (skus == null) { + return Mono.error(new IllegalArgumentException("Parameter skus 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + skus, + expand, + top, + orderby, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby) { + return listWithResponseAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync( + String location, String edgeZone, String publisherName, String offer, String skus) { + final String expand = null; + final Integer top = null; + final String orderby = null; + return listWithResponseAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list( + String location, String edgeZone, String publisherName, String offer, String skus) { + final String expand = null; + final Integer top = null; + final String orderby = null; + return listAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby).block(); + } + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + return listWithResponseAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby, context) + .block(); + } + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listOffersWithResponseAsync( + String location, String edgeZone, String publisherName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listOffers( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listOffersWithResponseAsync( + String location, String edgeZone, String publisherName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOffers( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOffersAsync( + String location, String edgeZone, String publisherName) { + return listOffersWithResponseAsync(location, edgeZone, publisherName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listOffers(String location, String edgeZone, String publisherName) { + return listOffersAsync(location, edgeZone, publisherName).block(); + } + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listOffersWithResponse( + String location, String edgeZone, String publisherName, Context context) { + return listOffersWithResponseAsync(location, edgeZone, publisherName, context).block(); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPublishersWithResponseAsync( + String location, String edgeZone) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPublishers( + this.client.getEndpoint(), + location, + edgeZone, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPublishersWithResponseAsync( + String location, String edgeZone, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPublishers( + this.client.getEndpoint(), + location, + edgeZone, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPublishersAsync(String location, String edgeZone) { + return listPublishersWithResponseAsync(location, edgeZone) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listPublishers(String location, String edgeZone) { + return listPublishersAsync(location, edgeZone).block(); + } + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listPublishersWithResponse( + String location, String edgeZone, Context context) { + return listPublishersWithResponseAsync(location, edgeZone, context).block(); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listSkusWithResponseAsync( + String location, String edgeZone, String publisherName, String offer) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSkus( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listSkusWithResponseAsync( + String location, String edgeZone, String publisherName, String offer, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (edgeZone == null) { + return Mono.error(new IllegalArgumentException("Parameter edgeZone is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + if (offer == null) { + return Mono.error(new IllegalArgumentException("Parameter offer 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSkus( + this.client.getEndpoint(), + location, + edgeZone, + publisherName, + offer, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusAsync( + String location, String edgeZone, String publisherName, String offer) { + return listSkusWithResponseAsync(location, edgeZone, publisherName, offer) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listSkus( + String location, String edgeZone, String publisherName, String offer) { + return listSkusAsync(location, edgeZone, publisherName, offer).block(); + } + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listSkusWithResponse( + String location, String edgeZone, String publisherName, String offer, Context context) { + return listSkusWithResponseAsync(location, edgeZone, publisherName, offer, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesImpl.java new file mode 100644 index 0000000000000..d8083500da65d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesEdgeZonesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineImagesEdgeZonesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImage; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageResource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImagesEdgeZones; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class VirtualMachineImagesEdgeZonesImpl implements VirtualMachineImagesEdgeZones { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImagesEdgeZonesImpl.class); + + private final VirtualMachineImagesEdgeZonesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineImagesEdgeZonesImpl( + VirtualMachineImagesEdgeZonesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachineImage get( + String location, String edgeZone, String publisherName, String offer, String skus, String version) { + VirtualMachineImageInner inner = + this.serviceClient().get(location, edgeZone, publisherName, offer, skus, version); + if (inner != null) { + return new VirtualMachineImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String version, + Context context) { + Response inner = + this.serviceClient().getWithResponse(location, edgeZone, publisherName, offer, skus, version, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List list( + String location, String edgeZone, String publisherName, String offer, String skus) { + List inner = + this.serviceClient().list(location, edgeZone, publisherName, offer, skus); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + Response> inner = + this + .serviceClient() + .listWithResponse(location, edgeZone, publisherName, offer, skus, expand, top, orderby, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listOffers(String location, String edgeZone, String publisherName) { + List inner = + this.serviceClient().listOffers(location, edgeZone, publisherName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listOffersWithResponse( + String location, String edgeZone, String publisherName, Context context) { + Response> inner = + this.serviceClient().listOffersWithResponse(location, edgeZone, publisherName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listPublishers(String location, String edgeZone) { + List inner = this.serviceClient().listPublishers(location, edgeZone); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listPublishersWithResponse( + String location, String edgeZone, Context context) { + Response> inner = + this.serviceClient().listPublishersWithResponse(location, edgeZone, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listSkus( + String location, String edgeZone, String publisherName, String offer) { + List inner = + this.serviceClient().listSkus(location, edgeZone, publisherName, offer); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listSkusWithResponse( + String location, String edgeZone, String publisherName, String offer, Context context) { + Response> inner = + this.serviceClient().listSkusWithResponse(location, edgeZone, publisherName, offer, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + private VirtualMachineImagesEdgeZonesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesImpl.java new file mode 100644 index 0000000000000..8fdc8a99a6eab --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImagesImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineImagesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImage; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImageResource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineImages; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class VirtualMachineImagesImpl implements VirtualMachineImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImagesImpl.class); + + private final VirtualMachineImagesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineImagesImpl( + VirtualMachineImagesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachineImage get(String location, String publisherName, String offer, String skus, String version) { + VirtualMachineImageInner inner = this.serviceClient().get(location, publisherName, offer, skus, version); + if (inner != null) { + return new VirtualMachineImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String location, String publisherName, String offer, String skus, String version, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, publisherName, offer, skus, version, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List list(String location, String publisherName, String offer, String skus) { + List inner = this.serviceClient().list(location, publisherName, offer, skus); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse( + String location, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context) { + Response> inner = + this.serviceClient().listWithResponse(location, publisherName, offer, skus, expand, top, orderby, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listOffers(String location, String publisherName) { + List inner = this.serviceClient().listOffers(location, publisherName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listOffersWithResponse( + String location, String publisherName, Context context) { + Response> inner = + this.serviceClient().listOffersWithResponse(location, publisherName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listPublishers(String location) { + List inner = this.serviceClient().listPublishers(location); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listPublishersWithResponse(String location, Context context) { + Response> inner = + this.serviceClient().listPublishersWithResponse(location, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listSkus(String location, String publisherName, String offer) { + List inner = this.serviceClient().listSkus(location, publisherName, offer); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listSkusWithResponse( + String location, String publisherName, String offer, Context context) { + Response> inner = + this.serviceClient().listSkusWithResponse(location, publisherName, offer, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new VirtualMachineImageResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + private VirtualMachineImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImpl.java new file mode 100644 index 0000000000000..2f2a82ea043cd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineImpl.java @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.RetrieveBootDiagnosticsDataResult; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.RunCommandResult; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachine; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAssessPatchesResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class VirtualMachineImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private VirtualMachineInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 Plan plan() { + return this.innerModel().plan(); + } + + public List resources() { + List inner = this.innerModel().resources(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineExtensionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineIdentity identity() { + return this.innerModel().identity(); + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public SecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public DiagnosticsProfile diagnosticsProfile() { + return this.innerModel().diagnosticsProfile(); + } + + public SubResource availabilitySet() { + return this.innerModel().availabilitySet(); + } + + public SubResource virtualMachineScaleSet() { + return this.innerModel().virtualMachineScaleSet(); + } + + public SubResource proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public VirtualMachinePriorityTypes priority() { + return this.innerModel().priority(); + } + + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.innerModel().evictionPolicy(); + } + + public BillingProfile billingProfile() { + return this.innerModel().billingProfile(); + } + + public SubResource host() { + return this.innerModel().host(); + } + + public SubResource hostGroup() { + return this.innerModel().hostGroup(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineInstanceView instanceView() { + VirtualMachineInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new VirtualMachineInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public String licenseType() { + return this.innerModel().licenseType(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String extensionsTimeBudget() { + return this.innerModel().extensionsTimeBudget(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public ScheduledEventsProfile scheduledEventsProfile() { + return this.innerModel().scheduledEventsProfile(); + } + + public String userData() { + return this.innerModel().userData(); + } + + public CapacityReservationProfile capacityReservation() { + return this.innerModel().capacityReservation(); + } + + public ApplicationProfile applicationProfile() { + return this.innerModel().applicationProfile(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmName; + + private VirtualMachineUpdateInner updateParameters; + + public VirtualMachineImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualMachine create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachine create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), context); + return this; + } + + VirtualMachineImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineInner(); + this.serviceManager = serviceManager; + this.vmName = name; + } + + public VirtualMachineImpl update() { + this.updateParameters = new VirtualMachineUpdateInner(); + return this; + } + + public VirtualMachine apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .update(resourceGroupName, vmName, updateParameters, Context.NONE); + return this; + } + + public VirtualMachine apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .update(resourceGroupName, vmName, updateParameters, context); + return this; + } + + VirtualMachineImpl( + VirtualMachineInner innerObject, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + } + + public VirtualMachine refresh() { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, vmName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachine refresh(Context context) { + InstanceViewTypes localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, vmName, localExpand, context) + .getValue(); + return this; + } + + public VirtualMachineCaptureResult capture(VirtualMachineCaptureParameters parameters) { + return serviceManager.virtualMachines().capture(resourceGroupName, vmName, parameters); + } + + public VirtualMachineCaptureResult capture(VirtualMachineCaptureParameters parameters, Context context) { + return serviceManager.virtualMachines().capture(resourceGroupName, vmName, parameters, context); + } + + public void convertToManagedDisks() { + serviceManager.virtualMachines().convertToManagedDisks(resourceGroupName, vmName); + } + + public void convertToManagedDisks(Context context) { + serviceManager.virtualMachines().convertToManagedDisks(resourceGroupName, vmName, context); + } + + public void deallocate(Boolean hibernate) { + serviceManager.virtualMachines().deallocate(resourceGroupName, vmName, hibernate); + } + + public void deallocate() { + serviceManager.virtualMachines().deallocate(resourceGroupName, vmName); + } + + public void deallocate(Boolean hibernate, Context context) { + serviceManager.virtualMachines().deallocate(resourceGroupName, vmName, hibernate, context); + } + + public void generalize() { + serviceManager.virtualMachines().generalize(resourceGroupName, vmName); + } + + public Response generalizeWithResponse(Context context) { + return serviceManager.virtualMachines().generalizeWithResponse(resourceGroupName, vmName, context); + } + + public void powerOff(Boolean skipShutdown) { + serviceManager.virtualMachines().powerOff(resourceGroupName, vmName, skipShutdown); + } + + public void powerOff() { + serviceManager.virtualMachines().powerOff(resourceGroupName, vmName); + } + + public void powerOff(Boolean skipShutdown, Context context) { + serviceManager.virtualMachines().powerOff(resourceGroupName, vmName, skipShutdown, context); + } + + public void reapply() { + serviceManager.virtualMachines().reapply(resourceGroupName, vmName); + } + + public void reapply(Context context) { + serviceManager.virtualMachines().reapply(resourceGroupName, vmName, context); + } + + public void restart() { + serviceManager.virtualMachines().restart(resourceGroupName, vmName); + } + + public void restart(Context context) { + serviceManager.virtualMachines().restart(resourceGroupName, vmName, context); + } + + public void start() { + serviceManager.virtualMachines().start(resourceGroupName, vmName); + } + + public void start(Context context) { + serviceManager.virtualMachines().start(resourceGroupName, vmName, context); + } + + public void redeploy() { + serviceManager.virtualMachines().redeploy(resourceGroupName, vmName); + } + + public void redeploy(Context context) { + serviceManager.virtualMachines().redeploy(resourceGroupName, vmName, context); + } + + public void reimage(VirtualMachineReimageParameters parameters) { + serviceManager.virtualMachines().reimage(resourceGroupName, vmName, parameters); + } + + public void reimage() { + serviceManager.virtualMachines().reimage(resourceGroupName, vmName); + } + + public void reimage(VirtualMachineReimageParameters parameters, Context context) { + serviceManager.virtualMachines().reimage(resourceGroupName, vmName, parameters, context); + } + + public RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData() { + return serviceManager.virtualMachines().retrieveBootDiagnosticsData(resourceGroupName, vmName); + } + + public Response retrieveBootDiagnosticsDataWithResponse( + Integer sasUriExpirationTimeInMinutes, Context context) { + return serviceManager + .virtualMachines() + .retrieveBootDiagnosticsDataWithResponse(resourceGroupName, vmName, sasUriExpirationTimeInMinutes, context); + } + + public void performMaintenance() { + serviceManager.virtualMachines().performMaintenance(resourceGroupName, vmName); + } + + public void performMaintenance(Context context) { + serviceManager.virtualMachines().performMaintenance(resourceGroupName, vmName, context); + } + + public void simulateEviction() { + serviceManager.virtualMachines().simulateEviction(resourceGroupName, vmName); + } + + public Response simulateEvictionWithResponse(Context context) { + return serviceManager.virtualMachines().simulateEvictionWithResponse(resourceGroupName, vmName, context); + } + + public VirtualMachineAssessPatchesResult assessPatches() { + return serviceManager.virtualMachines().assessPatches(resourceGroupName, vmName); + } + + public VirtualMachineAssessPatchesResult assessPatches(Context context) { + return serviceManager.virtualMachines().assessPatches(resourceGroupName, vmName, context); + } + + public VirtualMachineInstallPatchesResult installPatches( + VirtualMachineInstallPatchesParameters installPatchesInput) { + return serviceManager.virtualMachines().installPatches(resourceGroupName, vmName, installPatchesInput); + } + + public VirtualMachineInstallPatchesResult installPatches( + VirtualMachineInstallPatchesParameters installPatchesInput, Context context) { + return serviceManager.virtualMachines().installPatches(resourceGroupName, vmName, installPatchesInput, context); + } + + public RunCommandResult runCommand(RunCommandInput parameters) { + return serviceManager.virtualMachines().runCommand(resourceGroupName, vmName, parameters); + } + + public RunCommandResult runCommand(RunCommandInput parameters, Context context) { + return serviceManager.virtualMachines().runCommand(resourceGroupName, vmName, parameters, context); + } + + public VirtualMachineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public VirtualMachineImpl withPlan(Plan plan) { + if (isInCreateMode()) { + this.innerModel().withPlan(plan); + return this; + } else { + this.updateParameters.withPlan(plan); + return this; + } + } + + public VirtualMachineImpl withIdentity(VirtualMachineIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public VirtualMachineImpl withZones(List zones) { + if (isInCreateMode()) { + this.innerModel().withZones(zones); + return this; + } else { + this.updateParameters.withZones(zones); + return this; + } + } + + public VirtualMachineImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineImpl withHardwareProfile(HardwareProfile hardwareProfile) { + if (isInCreateMode()) { + this.innerModel().withHardwareProfile(hardwareProfile); + return this; + } else { + this.updateParameters.withHardwareProfile(hardwareProfile); + return this; + } + } + + public VirtualMachineImpl withStorageProfile(StorageProfile storageProfile) { + if (isInCreateMode()) { + this.innerModel().withStorageProfile(storageProfile); + return this; + } else { + this.updateParameters.withStorageProfile(storageProfile); + return this; + } + } + + public VirtualMachineImpl withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (isInCreateMode()) { + this.innerModel().withAdditionalCapabilities(additionalCapabilities); + return this; + } else { + this.updateParameters.withAdditionalCapabilities(additionalCapabilities); + return this; + } + } + + public VirtualMachineImpl withOsProfile(OSProfile osProfile) { + if (isInCreateMode()) { + this.innerModel().withOsProfile(osProfile); + return this; + } else { + this.updateParameters.withOsProfile(osProfile); + return this; + } + } + + public VirtualMachineImpl withNetworkProfile(NetworkProfile networkProfile) { + if (isInCreateMode()) { + this.innerModel().withNetworkProfile(networkProfile); + return this; + } else { + this.updateParameters.withNetworkProfile(networkProfile); + return this; + } + } + + public VirtualMachineImpl withSecurityProfile(SecurityProfile securityProfile) { + if (isInCreateMode()) { + this.innerModel().withSecurityProfile(securityProfile); + return this; + } else { + this.updateParameters.withSecurityProfile(securityProfile); + return this; + } + } + + public VirtualMachineImpl withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + if (isInCreateMode()) { + this.innerModel().withDiagnosticsProfile(diagnosticsProfile); + return this; + } else { + this.updateParameters.withDiagnosticsProfile(diagnosticsProfile); + return this; + } + } + + public VirtualMachineImpl withAvailabilitySet(SubResource availabilitySet) { + if (isInCreateMode()) { + this.innerModel().withAvailabilitySet(availabilitySet); + return this; + } else { + this.updateParameters.withAvailabilitySet(availabilitySet); + return this; + } + } + + public VirtualMachineImpl withVirtualMachineScaleSet(SubResource virtualMachineScaleSet) { + if (isInCreateMode()) { + this.innerModel().withVirtualMachineScaleSet(virtualMachineScaleSet); + return this; + } else { + this.updateParameters.withVirtualMachineScaleSet(virtualMachineScaleSet); + return this; + } + } + + public VirtualMachineImpl withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (isInCreateMode()) { + this.innerModel().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } else { + this.updateParameters.withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + } + + public VirtualMachineImpl withPriority(VirtualMachinePriorityTypes priority) { + if (isInCreateMode()) { + this.innerModel().withPriority(priority); + return this; + } else { + this.updateParameters.withPriority(priority); + return this; + } + } + + public VirtualMachineImpl withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) { + if (isInCreateMode()) { + this.innerModel().withEvictionPolicy(evictionPolicy); + return this; + } else { + this.updateParameters.withEvictionPolicy(evictionPolicy); + return this; + } + } + + public VirtualMachineImpl withBillingProfile(BillingProfile billingProfile) { + if (isInCreateMode()) { + this.innerModel().withBillingProfile(billingProfile); + return this; + } else { + this.updateParameters.withBillingProfile(billingProfile); + return this; + } + } + + public VirtualMachineImpl withHost(SubResource host) { + if (isInCreateMode()) { + this.innerModel().withHost(host); + return this; + } else { + this.updateParameters.withHost(host); + return this; + } + } + + public VirtualMachineImpl withHostGroup(SubResource hostGroup) { + if (isInCreateMode()) { + this.innerModel().withHostGroup(hostGroup); + return this; + } else { + this.updateParameters.withHostGroup(hostGroup); + return this; + } + } + + public VirtualMachineImpl withLicenseType(String licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public VirtualMachineImpl withExtensionsTimeBudget(String extensionsTimeBudget) { + if (isInCreateMode()) { + this.innerModel().withExtensionsTimeBudget(extensionsTimeBudget); + return this; + } else { + this.updateParameters.withExtensionsTimeBudget(extensionsTimeBudget); + return this; + } + } + + public VirtualMachineImpl withPlatformFaultDomain(Integer platformFaultDomain) { + if (isInCreateMode()) { + this.innerModel().withPlatformFaultDomain(platformFaultDomain); + return this; + } else { + this.updateParameters.withPlatformFaultDomain(platformFaultDomain); + return this; + } + } + + public VirtualMachineImpl withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + if (isInCreateMode()) { + this.innerModel().withScheduledEventsProfile(scheduledEventsProfile); + return this; + } else { + this.updateParameters.withScheduledEventsProfile(scheduledEventsProfile); + return this; + } + } + + public VirtualMachineImpl withUserData(String userData) { + if (isInCreateMode()) { + this.innerModel().withUserData(userData); + return this; + } else { + this.updateParameters.withUserData(userData); + return this; + } + } + + public VirtualMachineImpl withCapacityReservation(CapacityReservationProfile capacityReservation) { + if (isInCreateMode()) { + this.innerModel().withCapacityReservation(capacityReservation); + return this; + } else { + this.updateParameters.withCapacityReservation(capacityReservation); + return this; + } + } + + public VirtualMachineImpl withApplicationProfile(ApplicationProfile applicationProfile) { + if (isInCreateMode()) { + this.innerModel().withApplicationProfile(applicationProfile); + return this; + } else { + this.updateParameters.withApplicationProfile(applicationProfile); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstallPatchesResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstallPatchesResultImpl.java new file mode 100644 index 0000000000000..1c05453f22fc2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstallPatchesResultImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiError; +import com.azure.resourcemanager.compute.generated.models.PatchInstallationDetail; +import com.azure.resourcemanager.compute.generated.models.PatchOperationStatus; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchRebootStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesResult; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineInstallPatchesResultImpl implements VirtualMachineInstallPatchesResult { + private VirtualMachineInstallPatchesResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineInstallPatchesResultImpl( + VirtualMachineInstallPatchesResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public PatchOperationStatus status() { + return this.innerModel().status(); + } + + public String installationActivityId() { + return this.innerModel().installationActivityId(); + } + + public VMGuestPatchRebootStatus rebootStatus() { + return this.innerModel().rebootStatus(); + } + + public Boolean maintenanceWindowExceeded() { + return this.innerModel().maintenanceWindowExceeded(); + } + + public Integer excludedPatchCount() { + return this.innerModel().excludedPatchCount(); + } + + public Integer notSelectedPatchCount() { + return this.innerModel().notSelectedPatchCount(); + } + + public Integer pendingPatchCount() { + return this.innerModel().pendingPatchCount(); + } + + public Integer installedPatchCount() { + return this.innerModel().installedPatchCount(); + } + + public Integer failedPatchCount() { + return this.innerModel().failedPatchCount(); + } + + public List patches() { + List inner = this.innerModel().patches(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime startDateTime() { + return this.innerModel().startDateTime(); + } + + public ApiError error() { + return this.innerModel().error(); + } + + public VirtualMachineInstallPatchesResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstanceViewImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstanceViewImpl.java new file mode 100644 index 0000000000000..ca75f21d9f2f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineInstanceViewImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.BootDiagnosticsInstanceView; +import com.azure.resourcemanager.compute.generated.models.DiskInstanceView; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationType; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.MaintenanceRedeployStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAgentInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineHealthStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePatchStatus; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineInstanceViewImpl implements VirtualMachineInstanceView { + private VirtualMachineInstanceViewInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineInstanceViewImpl( + VirtualMachineInstanceViewInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer platformUpdateDomain() { + return this.innerModel().platformUpdateDomain(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public String computerName() { + return this.innerModel().computerName(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String osVersion() { + return this.innerModel().osVersion(); + } + + public HyperVGenerationType hyperVGeneration() { + return this.innerModel().hyperVGeneration(); + } + + public String rdpThumbPrint() { + return this.innerModel().rdpThumbPrint(); + } + + public VirtualMachineAgentInstanceView vmAgent() { + return this.innerModel().vmAgent(); + } + + public MaintenanceRedeployStatus maintenanceRedeployStatus() { + return this.innerModel().maintenanceRedeployStatus(); + } + + public List disks() { + List inner = this.innerModel().disks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List extensions() { + List inner = this.innerModel().extensions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineHealthStatus vmHealth() { + return this.innerModel().vmHealth(); + } + + public BootDiagnosticsInstanceView bootDiagnostics() { + return this.innerModel().bootDiagnostics(); + } + + public String assignedHost() { + return this.innerModel().assignedHost(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachinePatchStatus patchStatus() { + return this.innerModel().patchStatus(); + } + + public VirtualMachineInstanceViewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinePropertiesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinePropertiesImpl.java new file mode 100644 index 0000000000000..2d1883d77bd14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinePropertiesImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachinePropertiesInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineProperties; +import java.time.OffsetDateTime; + +public final class VirtualMachinePropertiesImpl implements VirtualMachineProperties { + private VirtualMachinePropertiesInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachinePropertiesImpl( + VirtualMachinePropertiesInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public SecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public DiagnosticsProfile diagnosticsProfile() { + return this.innerModel().diagnosticsProfile(); + } + + public SubResource availabilitySet() { + return this.innerModel().availabilitySet(); + } + + public SubResource virtualMachineScaleSet() { + return this.innerModel().virtualMachineScaleSet(); + } + + public SubResource proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public VirtualMachinePriorityTypes priority() { + return this.innerModel().priority(); + } + + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.innerModel().evictionPolicy(); + } + + public BillingProfile billingProfile() { + return this.innerModel().billingProfile(); + } + + public SubResource host() { + return this.innerModel().host(); + } + + public SubResource hostGroup() { + return this.innerModel().hostGroup(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineInstanceView instanceView() { + VirtualMachineInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new VirtualMachineInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public String licenseType() { + return this.innerModel().licenseType(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String extensionsTimeBudget() { + return this.innerModel().extensionsTimeBudget(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public ScheduledEventsProfile scheduledEventsProfile() { + return this.innerModel().scheduledEventsProfile(); + } + + public String userData() { + return this.innerModel().userData(); + } + + public CapacityReservationProfile capacityReservation() { + return this.innerModel().capacityReservation(); + } + + public ApplicationProfile applicationProfile() { + return this.innerModel().applicationProfile(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public VirtualMachinePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandImpl.java new file mode 100644 index 0000000000000..e0fb4fe238f97 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandImpl.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommand; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineRunCommandImpl + implements VirtualMachineRunCommand, VirtualMachineRunCommand.Definition, VirtualMachineRunCommand.Update { + private VirtualMachineRunCommandInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 VirtualMachineRunCommandScriptSource source() { + return this.innerModel().source(); + } + + public List parameters() { + List inner = this.innerModel().parameters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List protectedParameters() { + List inner = this.innerModel().protectedParameters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean asyncExecution() { + return this.innerModel().asyncExecution(); + } + + public String runAsUser() { + return this.innerModel().runAsUser(); + } + + public String runAsPassword() { + return this.innerModel().runAsPassword(); + } + + public Integer timeoutInSeconds() { + return this.innerModel().timeoutInSeconds(); + } + + public String outputBlobUri() { + return this.innerModel().outputBlobUri(); + } + + public String errorBlobUri() { + return this.innerModel().errorBlobUri(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineRunCommandInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineRunCommandInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmName; + + private String runCommandName; + + private VirtualMachineRunCommandUpdate updateRunCommand; + + public VirtualMachineRunCommandImpl withExistingVirtualMachine(String resourceGroupName, String vmName) { + this.resourceGroupName = resourceGroupName; + this.vmName = vmName; + return this; + } + + public VirtualMachineRunCommand create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .createOrUpdate(resourceGroupName, vmName, runCommandName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineRunCommand create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .createOrUpdate(resourceGroupName, vmName, runCommandName, this.innerModel(), context); + return this; + } + + VirtualMachineRunCommandImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineRunCommandInner(); + this.serviceManager = serviceManager; + this.runCommandName = name; + } + + public VirtualMachineRunCommandImpl update() { + this.updateRunCommand = new VirtualMachineRunCommandUpdate(); + return this; + } + + public VirtualMachineRunCommand apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .update(resourceGroupName, vmName, runCommandName, updateRunCommand, Context.NONE); + return this; + } + + public VirtualMachineRunCommand apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .update(resourceGroupName, vmName, runCommandName, updateRunCommand, context); + return this; + } + + VirtualMachineRunCommandImpl( + VirtualMachineRunCommandInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + this.runCommandName = Utils.getValueFromIdByName(innerObject.id(), "runCommands"); + } + + public VirtualMachineRunCommand refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .getByVirtualMachineWithResponse(resourceGroupName, vmName, runCommandName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineRunCommand refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineRunCommands() + .getByVirtualMachineWithResponse(resourceGroupName, vmName, runCommandName, localExpand, context) + .getValue(); + return this; + } + + public VirtualMachineRunCommandImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineRunCommandImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineRunCommandImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateRunCommand.withTags(tags); + return this; + } + } + + public VirtualMachineRunCommandImpl withSource(VirtualMachineRunCommandScriptSource source) { + if (isInCreateMode()) { + this.innerModel().withSource(source); + return this; + } else { + this.updateRunCommand.withSource(source); + return this; + } + } + + public VirtualMachineRunCommandImpl withParameters(List parameters) { + if (isInCreateMode()) { + this.innerModel().withParameters(parameters); + return this; + } else { + this.updateRunCommand.withParameters(parameters); + return this; + } + } + + public VirtualMachineRunCommandImpl withProtectedParameters(List protectedParameters) { + if (isInCreateMode()) { + this.innerModel().withProtectedParameters(protectedParameters); + return this; + } else { + this.updateRunCommand.withProtectedParameters(protectedParameters); + return this; + } + } + + public VirtualMachineRunCommandImpl withAsyncExecution(Boolean asyncExecution) { + if (isInCreateMode()) { + this.innerModel().withAsyncExecution(asyncExecution); + return this; + } else { + this.updateRunCommand.withAsyncExecution(asyncExecution); + return this; + } + } + + public VirtualMachineRunCommandImpl withRunAsUser(String runAsUser) { + if (isInCreateMode()) { + this.innerModel().withRunAsUser(runAsUser); + return this; + } else { + this.updateRunCommand.withRunAsUser(runAsUser); + return this; + } + } + + public VirtualMachineRunCommandImpl withRunAsPassword(String runAsPassword) { + if (isInCreateMode()) { + this.innerModel().withRunAsPassword(runAsPassword); + return this; + } else { + this.updateRunCommand.withRunAsPassword(runAsPassword); + return this; + } + } + + public VirtualMachineRunCommandImpl withTimeoutInSeconds(Integer timeoutInSeconds) { + if (isInCreateMode()) { + this.innerModel().withTimeoutInSeconds(timeoutInSeconds); + return this; + } else { + this.updateRunCommand.withTimeoutInSeconds(timeoutInSeconds); + return this; + } + } + + public VirtualMachineRunCommandImpl withOutputBlobUri(String outputBlobUri) { + if (isInCreateMode()) { + this.innerModel().withOutputBlobUri(outputBlobUri); + return this; + } else { + this.updateRunCommand.withOutputBlobUri(outputBlobUri); + return this; + } + } + + public VirtualMachineRunCommandImpl withErrorBlobUri(String errorBlobUri) { + if (isInCreateMode()) { + this.innerModel().withErrorBlobUri(errorBlobUri); + return this; + } else { + this.updateRunCommand.withErrorBlobUri(errorBlobUri); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsClientImpl.java new file mode 100644 index 0000000000000..714e84b6968d8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsClientImpl.java @@ -0,0 +1,1961 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.RunCommandListResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandsListResult; +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 VirtualMachineRunCommandsClient. */ +public final class VirtualMachineRunCommandsClientImpl implements VirtualMachineRunCommandsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineRunCommandsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineRunCommandsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineRunCommandsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineRunCommandsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineRunCommands to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineRunCommandsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @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.Compute/locations/{location}/runCommands/{commandId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("commandId") String commandId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommands/{runCommandName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineRunCommandInner runCommand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommands/{runCommandName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineRunCommandUpdate runCommand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommands/{runCommandName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommands/{runCommandName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByVirtualMachine( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @PathParam("runCommandName") String runCommandName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommands") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByVirtualMachine( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("$expand") String expand, + @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> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByVirtualMachineNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + location, + apiVersion, + 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 available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location) { + return new PagedFlux<>(() -> listSinglePageAsync(location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(location, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location) { + return new PagedIterable<>(listAsync(location)); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, Context context) { + return new PagedIterable<>(listAsync(location, context)); + } + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific run command for a subscription in a location along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String commandId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (commandId == null) { + return Mono.error(new IllegalArgumentException("Parameter commandId 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + commandId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific run command for a subscription in a location along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String commandId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (commandId == null) { + return Mono.error(new IllegalArgumentException("Parameter commandId 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + location, + commandId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific run command for a subscription in a location on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String commandId) { + return getWithResponseAsync(location, commandId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific run command for a subscription in a location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunCommandDocumentInner get(String location, String commandId) { + return getAsync(location, commandId).block(); + } + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific run command for a subscription in a location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String commandId, Context context) { + return getWithResponseAsync(location, commandId, context).block(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmName, runCommandName, runCommand); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmName, runCommandName, runCommand, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + context); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).getSyncPoller(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand, context).getSyncPoller(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return createOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).block(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return createOrUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand, context).block(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> beginUpdateAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmName, runCommandName, runCommand); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + this.client.getContext()); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> beginUpdateAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmName, runCommandName, runCommand, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + context); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand).getSyncPoller(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return beginUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand, context).getSyncPoller(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return beginUpdateAsync(resourceGroupName, vmName, runCommandName, runCommand, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner update( + String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return updateAsync(resourceGroupName, vmName, runCommandName, runCommand).block(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmName, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return updateAsync(resourceGroupName, vmName, runCommandName, runCommand, context).block(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, String runCommandName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, String runCommandName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, String runCommandName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vmName, runCommandName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, String runCommandName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmName, runCommandName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String runCommandName) { + return beginDeleteAsync(resourceGroupName, vmName, runCommandName).getSyncPoller(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, String runCommandName, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, runCommandName, context).getSyncPoller(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String runCommandName) { + return beginDeleteAsync(resourceGroupName, vmName, runCommandName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String runCommandName, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, runCommandName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String runCommandName) { + deleteAsync(resourceGroupName, vmName, runCommandName).block(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, String runCommandName, Context context) { + deleteAsync(resourceGroupName, vmName, runCommandName, context).block(); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVirtualMachineWithResponseAsync( + String resourceGroupName, String vmName, String runCommandName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .getByVirtualMachine( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVirtualMachineWithResponseAsync( + String resourceGroupName, String vmName, String runCommandName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .getByVirtualMachine( + this.client.getEndpoint(), + resourceGroupName, + vmName, + runCommandName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByVirtualMachineAsync( + String resourceGroupName, String vmName, String runCommandName, String expand) { + return getByVirtualMachineWithResponseAsync(resourceGroupName, vmName, runCommandName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByVirtualMachineAsync( + String resourceGroupName, String vmName, String runCommandName) { + final String expand = null; + return getByVirtualMachineWithResponseAsync(resourceGroupName, vmName, runCommandName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner getByVirtualMachine( + String resourceGroupName, String vmName, String runCommandName) { + final String expand = null; + return getByVirtualMachineAsync(resourceGroupName, vmName, runCommandName, expand).block(); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByVirtualMachineWithResponse( + String resourceGroupName, String vmName, String runCommandName, String expand, Context context) { + return getByVirtualMachineWithResponseAsync(resourceGroupName, vmName, runCommandName, expand, context).block(); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineSinglePageAsync( + String resourceGroupName, String vmName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .listByVirtualMachine( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + 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())); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineSinglePageAsync( + String resourceGroupName, String vmName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listByVirtualMachine( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVirtualMachineAsync( + String resourceGroupName, String vmName, String expand) { + return new PagedFlux<>( + () -> listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand), + nextLink -> listByVirtualMachineNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVirtualMachineAsync( + String resourceGroupName, String vmName) { + final String expand = null; + return new PagedFlux<>( + () -> listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand), + nextLink -> listByVirtualMachineNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVirtualMachineAsync( + String resourceGroupName, String vmName, String expand, Context context) { + return new PagedFlux<>( + () -> listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand, context), + nextLink -> listByVirtualMachineNextSinglePageAsync(nextLink, context)); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachine(String resourceGroupName, String vmName) { + final String expand = null; + return new PagedIterable<>(listByVirtualMachineAsync(resourceGroupName, vmName, expand)); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachine( + String resourceGroupName, String vmName, String expand, Context context) { + return new PagedIterable<>(listByVirtualMachineAsync(resourceGroupName, vmName, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response 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, text/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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineNextSinglePageAsync( + 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, text/json"; + return FluxUtil + .withContext( + context -> service.listByVirtualMachineNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listByVirtualMachineNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsImpl.java new file mode 100644 index 0000000000000..53c6bed0c0188 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineRunCommandsImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.RunCommandDocument; +import com.azure.resourcemanager.compute.generated.models.RunCommandDocumentBase; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommand; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommands; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineRunCommandsImpl implements VirtualMachineRunCommands { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandsImpl.class); + + private final VirtualMachineRunCommandsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineRunCommandsImpl( + VirtualMachineRunCommandsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); + return Utils.mapPage(inner, inner1 -> new RunCommandDocumentBaseImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, Context context) { + PagedIterable inner = this.serviceClient().list(location, context); + return Utils.mapPage(inner, inner1 -> new RunCommandDocumentBaseImpl(inner1, this.manager())); + } + + public RunCommandDocument get(String location, String commandId) { + RunCommandDocumentInner inner = this.serviceClient().get(location, commandId); + if (inner != null) { + return new RunCommandDocumentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String commandId, Context context) { + Response inner = this.serviceClient().getWithResponse(location, commandId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RunCommandDocumentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmName, String runCommandName) { + this.serviceClient().delete(resourceGroupName, vmName, runCommandName); + } + + public void delete(String resourceGroupName, String vmName, String runCommandName, Context context) { + this.serviceClient().delete(resourceGroupName, vmName, runCommandName, context); + } + + public VirtualMachineRunCommand getByVirtualMachine( + String resourceGroupName, String vmName, String runCommandName) { + VirtualMachineRunCommandInner inner = + this.serviceClient().getByVirtualMachine(resourceGroupName, vmName, runCommandName); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByVirtualMachineWithResponse( + String resourceGroupName, String vmName, String runCommandName, String expand, Context context) { + Response inner = + this + .serviceClient() + .getByVirtualMachineWithResponse(resourceGroupName, vmName, runCommandName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineRunCommandImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByVirtualMachine(String resourceGroupName, String vmName) { + PagedIterable inner = + this.serviceClient().listByVirtualMachine(resourceGroupName, vmName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineRunCommandImpl(inner1, this.manager())); + } + + public PagedIterable listByVirtualMachine( + String resourceGroupName, String vmName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByVirtualMachine(resourceGroupName, vmName, expand, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineRunCommandImpl(inner1, this.manager())); + } + + public VirtualMachineRunCommand getById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String runCommandName = Utils.getValueFromIdByName(id, "runCommands"); + if (runCommandName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id))); + } + String localExpand = null; + return this + .getByVirtualMachineWithResponse(resourceGroupName, vmName, runCommandName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String runCommandName = Utils.getValueFromIdByName(id, "runCommands"); + if (runCommandName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id))); + } + return this.getByVirtualMachineWithResponse(resourceGroupName, vmName, runCommandName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String runCommandName = Utils.getValueFromIdByName(id, "runCommands"); + if (runCommandName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id))); + } + this.delete(resourceGroupName, vmName, runCommandName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String runCommandName = Utils.getValueFromIdByName(id, "runCommands"); + if (runCommandName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'runCommands'.", id))); + } + this.delete(resourceGroupName, vmName, runCommandName, context); + } + + private VirtualMachineRunCommandsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineRunCommandImpl define(String name) { + return new VirtualMachineRunCommandImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionImpl.java new file mode 100644 index 0000000000000..9dea1f12b58b5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionUpdate; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineScaleSetExtensionImpl + implements VirtualMachineScaleSetExtension, + VirtualMachineScaleSetExtension.Definition, + VirtualMachineScaleSetExtension.Update { + private VirtualMachineScaleSetExtensionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String typeHandlerVersion() { + return this.innerModel().typeHandlerVersion(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public Boolean enableAutomaticUpgrade() { + return this.innerModel().enableAutomaticUpgrade(); + } + + public Object settings() { + return this.innerModel().settings(); + } + + public Object protectedSettings() { + return this.innerModel().protectedSettings(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public List provisionAfterExtensions() { + List inner = this.innerModel().provisionAfterExtensions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean suppressFailures() { + return this.innerModel().suppressFailures(); + } + + public Object protectedSettingsFromKeyVault() { + return this.innerModel().protectedSettingsFromKeyVault(); + } + + public VirtualMachineScaleSetExtensionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmScaleSetName; + + private String vmssExtensionName; + + private VirtualMachineScaleSetExtensionUpdate updateExtensionParameters; + + public VirtualMachineScaleSetExtensionImpl withExistingVirtualMachineScaleSet( + String resourceGroupName, String vmScaleSetName) { + this.resourceGroupName = resourceGroupName; + this.vmScaleSetName = vmScaleSetName; + return this; + } + + public VirtualMachineScaleSetExtension create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .createOrUpdate(resourceGroupName, vmScaleSetName, vmssExtensionName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineScaleSetExtension create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .createOrUpdate(resourceGroupName, vmScaleSetName, vmssExtensionName, this.innerModel(), context); + return this; + } + + VirtualMachineScaleSetExtensionImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineScaleSetExtensionInner(); + this.serviceManager = serviceManager; + this.vmssExtensionName = name; + } + + public VirtualMachineScaleSetExtensionImpl update() { + this.updateExtensionParameters = new VirtualMachineScaleSetExtensionUpdate(); + return this; + } + + public VirtualMachineScaleSetExtension apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .update(resourceGroupName, vmScaleSetName, vmssExtensionName, updateExtensionParameters, Context.NONE); + return this; + } + + public VirtualMachineScaleSetExtension apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .update(resourceGroupName, vmScaleSetName, vmssExtensionName, updateExtensionParameters, context); + return this; + } + + VirtualMachineScaleSetExtensionImpl( + VirtualMachineScaleSetExtensionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmScaleSetName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachineScaleSets"); + this.vmssExtensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public VirtualMachineScaleSetExtension refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .getWithResponse(resourceGroupName, vmScaleSetName, vmssExtensionName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineScaleSetExtension refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetExtensions() + .getWithResponse(resourceGroupName, vmScaleSetName, vmssExtensionName, localExpand, context) + .getValue(); + return this; + } + + public VirtualMachineScaleSetExtensionImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public VirtualMachineScaleSetExtensionImpl withForceUpdateTag(String forceUpdateTag) { + if (isInCreateMode()) { + this.innerModel().withForceUpdateTag(forceUpdateTag); + return this; + } else { + this.updateExtensionParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withPublisher(String publisher) { + if (isInCreateMode()) { + this.innerModel().withPublisher(publisher); + return this; + } else { + this.updateExtensionParameters.withPublisher(publisher); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withTypePropertiesType(String typePropertiesType) { + if (isInCreateMode()) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } else { + this.updateExtensionParameters.withTypePropertiesType(typePropertiesType); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withTypeHandlerVersion(String typeHandlerVersion) { + if (isInCreateMode()) { + this.innerModel().withTypeHandlerVersion(typeHandlerVersion); + return this; + } else { + this.updateExtensionParameters.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (isInCreateMode()) { + this.innerModel().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } else { + this.updateExtensionParameters.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (isInCreateMode()) { + this.innerModel().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } else { + this.updateExtensionParameters.withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withSettings(Object settings) { + if (isInCreateMode()) { + this.innerModel().withSettings(settings); + return this; + } else { + this.updateExtensionParameters.withSettings(settings); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withProtectedSettings(Object protectedSettings) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettings(protectedSettings); + return this; + } else { + this.updateExtensionParameters.withProtectedSettings(protectedSettings); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withProvisionAfterExtensions(List provisionAfterExtensions) { + if (isInCreateMode()) { + this.innerModel().withProvisionAfterExtensions(provisionAfterExtensions); + return this; + } else { + this.updateExtensionParameters.withProvisionAfterExtensions(provisionAfterExtensions); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withSuppressFailures(Boolean suppressFailures) { + if (isInCreateMode()) { + this.innerModel().withSuppressFailures(suppressFailures); + return this; + } else { + this.updateExtensionParameters.withSuppressFailures(suppressFailures); + return this; + } + } + + public VirtualMachineScaleSetExtensionImpl withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } else { + this.updateExtensionParameters.withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsClientImpl.java new file mode 100644 index 0000000000000..e93338e45fed8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsClientImpl.java @@ -0,0 +1,1576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.VirtualMachineScaleSetExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionListResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionUpdate; +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 VirtualMachineScaleSetExtensionsClient. + */ +public final class VirtualMachineScaleSetExtensionsClientImpl implements VirtualMachineScaleSetExtensionsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetExtensionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetExtensionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineScaleSetExtensionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetExtensions to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetExtensionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("vmssExtensionName") String vmssExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetExtensionInner extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("vmssExtensionName") String vmssExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetExtensionUpdate extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("vmssExtensionName") String vmssExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("vmssExtensionName") String vmssExtensionName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @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(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetExtensionInner.class, + VirtualMachineScaleSetExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetExtensionInner.class, + VirtualMachineScaleSetExtensionInner.class, + context); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters) + .getSyncPoller(); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).block(); + } + + /** + * The operation to create or update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionInner extensionParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context) + .block(); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetExtensionInner> + beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetExtensionInner.class, + VirtualMachineScaleSetExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetExtensionInner> + beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetExtensionInner.class, + VirtualMachineScaleSetExtensionInner.class, + context); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetExtensionInner> + beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters) + .getSyncPoller(); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetExtensionInner> + beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters) { + return updateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).block(); + } + + /** + * The operation to update an extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be updated. + * @param vmssExtensionName The name of the VM scale set extension. + * @param extensionParameters Parameters supplied to the Update VM scale set Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String vmssExtensionName, + VirtualMachineScaleSetExtensionUpdate extensionParameters, + Context context) { + return updateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, context).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String vmssExtensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String vmssExtensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, context).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String vmssExtensionName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String vmssExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String vmssExtensionName) { + deleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String vmssExtensionName, Context context) { + deleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, context).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (vmssExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmssExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + vmssExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetExtensionInner get( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + final String expand = null; + return getAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, context).block(); + } + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + 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 a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String vmScaleSetName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vmScaleSetName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vmScaleSetName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String vmScaleSetName) { + return new PagedIterable<>(listAsync(resourceGroupName, vmScaleSetName)); + } + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, vmScaleSetName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VM scale set extension operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VM scale set extension operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsImpl.java new file mode 100644 index 0000000000000..ce49b50baccb3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetExtensionsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetExtensionsImpl implements VirtualMachineScaleSetExtensions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionsImpl.class); + + private final VirtualMachineScaleSetExtensionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetExtensionsImpl( + VirtualMachineScaleSetExtensionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, vmssExtensionName); + } + + public void delete(String resourceGroupName, String vmScaleSetName, String vmssExtensionName, Context context) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, vmssExtensionName, context); + } + + public VirtualMachineScaleSetExtension get( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName) { + VirtualMachineScaleSetExtensionInner inner = + this.serviceClient().get(resourceGroupName, vmScaleSetName, vmssExtensionName); + if (inner != null) { + return new VirtualMachineScaleSetExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String vmScaleSetName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, vmScaleSetName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetExtensionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, vmScaleSetName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetExtensionImpl(inner1, this.manager())); + } + + public VirtualMachineScaleSetExtension getById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String vmssExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmssExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + String localExpand = null; + return this + .getWithResponse(resourceGroupName, vmScaleSetName, vmssExtensionName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String vmssExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmssExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String vmssExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmssExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmScaleSetName, vmssExtensionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String vmssExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmssExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmScaleSetName, vmssExtensionName, context); + } + + private VirtualMachineScaleSetExtensionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineScaleSetExtensionImpl define(String name) { + return new VirtualMachineScaleSetExtensionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetImpl.java new file mode 100644 index 0000000000000..0f18cb233d0c7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetImpl.java @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetVMScaleSets; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.OrchestrationMode; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSet; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateVMProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProfile; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineScaleSetImpl + implements VirtualMachineScaleSet, VirtualMachineScaleSet.Definition, VirtualMachineScaleSet.Update { + private VirtualMachineScaleSetInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public VirtualMachineScaleSetIdentity identity() { + return this.innerModel().identity(); + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public UpgradePolicy upgradePolicy() { + return this.innerModel().upgradePolicy(); + } + + public AutomaticRepairsPolicy automaticRepairsPolicy() { + return this.innerModel().automaticRepairsPolicy(); + } + + public VirtualMachineScaleSetVMProfile virtualMachineProfile() { + return this.innerModel().virtualMachineProfile(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Boolean overprovision() { + return this.innerModel().overprovision(); + } + + public Boolean doNotRunExtensionsOnOverprovisionedVMs() { + return this.innerModel().doNotRunExtensionsOnOverprovisionedVMs(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + public Boolean singlePlacementGroup() { + return this.innerModel().singlePlacementGroup(); + } + + public Boolean zoneBalance() { + return this.innerModel().zoneBalance(); + } + + public Integer platformFaultDomainCount() { + return this.innerModel().platformFaultDomainCount(); + } + + public SubResource proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public SubResource hostGroup() { + return this.innerModel().hostGroup(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public ScaleInPolicy scaleInPolicy() { + return this.innerModel().scaleInPolicy(); + } + + public OrchestrationMode orchestrationMode() { + return this.innerModel().orchestrationMode(); + } + + public SpotRestorePolicy spotRestorePolicy() { + return this.innerModel().spotRestorePolicy(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineScaleSetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmScaleSetName; + + private VirtualMachineScaleSetUpdate updateParameters; + + public VirtualMachineScaleSetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualMachineScaleSet create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate(resourceGroupName, vmScaleSetName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineScaleSet create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate(resourceGroupName, vmScaleSetName, this.innerModel(), context); + return this; + } + + VirtualMachineScaleSetImpl(String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineScaleSetInner(); + this.serviceManager = serviceManager; + this.vmScaleSetName = name; + } + + public VirtualMachineScaleSetImpl update() { + this.updateParameters = new VirtualMachineScaleSetUpdate(); + return this; + } + + public VirtualMachineScaleSet apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .update(resourceGroupName, vmScaleSetName, updateParameters, Context.NONE); + return this; + } + + public VirtualMachineScaleSet apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .update(resourceGroupName, vmScaleSetName, updateParameters, context); + return this; + } + + VirtualMachineScaleSetImpl( + VirtualMachineScaleSetInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmScaleSetName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachineScaleSets"); + } + + public VirtualMachineScaleSet refresh() { + ExpandTypesForGetVMScaleSets localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineScaleSet refresh(Context context) { + ExpandTypesForGetVMScaleSets localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSets() + .getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, localExpand, context) + .getValue(); + return this; + } + + public void deallocate(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().deallocate(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void deallocate() { + serviceManager.virtualMachineScaleSets().deallocate(resourceGroupName, vmScaleSetName); + } + + public void deallocate(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager.virtualMachineScaleSets().deallocate(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void deleteInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion) { + serviceManager + .virtualMachineScaleSets() + .deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion); + } + + public void deleteInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void deleteInstances( + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion, Context context) { + serviceManager + .virtualMachineScaleSets() + .deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context); + } + + public void powerOff(Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager + .virtualMachineScaleSets() + .powerOff(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs); + } + + public void powerOff() { + serviceManager.virtualMachineScaleSets().powerOff(resourceGroupName, vmScaleSetName); + } + + public void powerOff(Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager + .virtualMachineScaleSets() + .powerOff(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context); + } + + public void restart(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().restart(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void restart() { + serviceManager.virtualMachineScaleSets().restart(resourceGroupName, vmScaleSetName); + } + + public void restart(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager.virtualMachineScaleSets().restart(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void start(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().start(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void start() { + serviceManager.virtualMachineScaleSets().start(resourceGroupName, vmScaleSetName); + } + + public void start(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager.virtualMachineScaleSets().start(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void redeploy(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().redeploy(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void redeploy() { + serviceManager.virtualMachineScaleSets().redeploy(resourceGroupName, vmScaleSetName); + } + + public void redeploy(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager.virtualMachineScaleSets().redeploy(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void performMaintenance(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().performMaintenance(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void performMaintenance() { + serviceManager.virtualMachineScaleSets().performMaintenance(resourceGroupName, vmScaleSetName); + } + + public void performMaintenance(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager + .virtualMachineScaleSets() + .performMaintenance(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void updateInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().updateInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void updateInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Context context) { + serviceManager + .virtualMachineScaleSets() + .updateInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void reimage(VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + serviceManager.virtualMachineScaleSets().reimage(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput); + } + + public void reimage() { + serviceManager.virtualMachineScaleSets().reimage(resourceGroupName, vmScaleSetName); + } + + public void reimage(VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, Context context) { + serviceManager + .virtualMachineScaleSets() + .reimage(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context); + } + + public void reimageAll(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + serviceManager.virtualMachineScaleSets().reimageAll(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void reimageAll() { + serviceManager.virtualMachineScaleSets().reimageAll(resourceGroupName, vmScaleSetName); + } + + public void reimageAll(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) { + serviceManager.virtualMachineScaleSets().reimageAll(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void convertToSinglePlacementGroup(VMScaleSetConvertToSinglePlacementGroupInput parameters) { + serviceManager + .virtualMachineScaleSets() + .convertToSinglePlacementGroup(resourceGroupName, vmScaleSetName, parameters); + } + + public Response convertToSinglePlacementGroupWithResponse( + VMScaleSetConvertToSinglePlacementGroupInput parameters, Context context) { + return serviceManager + .virtualMachineScaleSets() + .convertToSinglePlacementGroupWithResponse(resourceGroupName, vmScaleSetName, parameters, context); + } + + public void setOrchestrationServiceState(OrchestrationServiceStateInput parameters) { + serviceManager + .virtualMachineScaleSets() + .setOrchestrationServiceState(resourceGroupName, vmScaleSetName, parameters); + } + + public void setOrchestrationServiceState(OrchestrationServiceStateInput parameters, Context context) { + serviceManager + .virtualMachineScaleSets() + .setOrchestrationServiceState(resourceGroupName, vmScaleSetName, parameters, context); + } + + public VirtualMachineScaleSetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineScaleSetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineScaleSetImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public VirtualMachineScaleSetImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public VirtualMachineScaleSetImpl withPlan(Plan plan) { + if (isInCreateMode()) { + this.innerModel().withPlan(plan); + return this; + } else { + this.updateParameters.withPlan(plan); + return this; + } + } + + public VirtualMachineScaleSetImpl withIdentity(VirtualMachineScaleSetIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public VirtualMachineScaleSetImpl withZones(List zones) { + this.innerModel().withZones(zones); + return this; + } + + public VirtualMachineScaleSetImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineScaleSetImpl withUpgradePolicy(UpgradePolicy upgradePolicy) { + if (isInCreateMode()) { + this.innerModel().withUpgradePolicy(upgradePolicy); + return this; + } else { + this.updateParameters.withUpgradePolicy(upgradePolicy); + return this; + } + } + + public VirtualMachineScaleSetImpl withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy) { + if (isInCreateMode()) { + this.innerModel().withAutomaticRepairsPolicy(automaticRepairsPolicy); + return this; + } else { + this.updateParameters.withAutomaticRepairsPolicy(automaticRepairsPolicy); + return this; + } + } + + public VirtualMachineScaleSetImpl withVirtualMachineProfile(VirtualMachineScaleSetVMProfile virtualMachineProfile) { + this.innerModel().withVirtualMachineProfile(virtualMachineProfile); + return this; + } + + public VirtualMachineScaleSetImpl withOverprovision(Boolean overprovision) { + if (isInCreateMode()) { + this.innerModel().withOverprovision(overprovision); + return this; + } else { + this.updateParameters.withOverprovision(overprovision); + return this; + } + } + + public VirtualMachineScaleSetImpl withDoNotRunExtensionsOnOverprovisionedVMs( + Boolean doNotRunExtensionsOnOverprovisionedVMs) { + if (isInCreateMode()) { + this.innerModel().withDoNotRunExtensionsOnOverprovisionedVMs(doNotRunExtensionsOnOverprovisionedVMs); + return this; + } else { + this.updateParameters.withDoNotRunExtensionsOnOverprovisionedVMs(doNotRunExtensionsOnOverprovisionedVMs); + return this; + } + } + + public VirtualMachineScaleSetImpl withSinglePlacementGroup(Boolean singlePlacementGroup) { + if (isInCreateMode()) { + this.innerModel().withSinglePlacementGroup(singlePlacementGroup); + return this; + } else { + this.updateParameters.withSinglePlacementGroup(singlePlacementGroup); + return this; + } + } + + public VirtualMachineScaleSetImpl withZoneBalance(Boolean zoneBalance) { + this.innerModel().withZoneBalance(zoneBalance); + return this; + } + + public VirtualMachineScaleSetImpl withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + this.innerModel().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + public VirtualMachineScaleSetImpl withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (isInCreateMode()) { + this.innerModel().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } else { + this.updateParameters.withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + } + + public VirtualMachineScaleSetImpl withHostGroup(SubResource hostGroup) { + this.innerModel().withHostGroup(hostGroup); + return this; + } + + public VirtualMachineScaleSetImpl withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (isInCreateMode()) { + this.innerModel().withAdditionalCapabilities(additionalCapabilities); + return this; + } else { + this.updateParameters.withAdditionalCapabilities(additionalCapabilities); + return this; + } + } + + public VirtualMachineScaleSetImpl withScaleInPolicy(ScaleInPolicy scaleInPolicy) { + if (isInCreateMode()) { + this.innerModel().withScaleInPolicy(scaleInPolicy); + return this; + } else { + this.updateParameters.withScaleInPolicy(scaleInPolicy); + return this; + } + } + + public VirtualMachineScaleSetImpl withOrchestrationMode(OrchestrationMode orchestrationMode) { + this.innerModel().withOrchestrationMode(orchestrationMode); + return this; + } + + public VirtualMachineScaleSetImpl withSpotRestorePolicy(SpotRestorePolicy spotRestorePolicy) { + this.innerModel().withSpotRestorePolicy(spotRestorePolicy); + return this; + } + + public VirtualMachineScaleSetImpl withVirtualMachineProfile( + VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile) { + this.updateParameters.withVirtualMachineProfile(virtualMachineProfile); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetInstanceViewImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetInstanceViewImpl.java new file mode 100644 index 0000000000000..b1d0e99ee7fc8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetInstanceViewImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceSummary; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetInstanceViewStatusesSummary; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionsSummary; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineScaleSetInstanceViewImpl implements VirtualMachineScaleSetInstanceView { + private VirtualMachineScaleSetInstanceViewInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetInstanceViewImpl( + VirtualMachineScaleSetInstanceViewInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine() { + return this.innerModel().virtualMachine(); + } + + public List extensions() { + List inner = this.innerModel().extensions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List orchestrationServices() { + List inner = this.innerModel().orchestrationServices(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineScaleSetInstanceViewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesClientImpl.java new file mode 100644 index 0000000000000..b69d346be6154 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesClientImpl.java @@ -0,0 +1,1006 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.Post; +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.polling.PollResult; +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.compute.generated.fluent.VirtualMachineScaleSetRollingUpgradesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RollingUpgradeStatusInfoInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +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 + * VirtualMachineScaleSetRollingUpgradesClient. + */ +public final class VirtualMachineScaleSetRollingUpgradesClientImpl + implements VirtualMachineScaleSetRollingUpgradesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetRollingUpgradesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetRollingUpgradesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetRollingUpgradesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetRollingUpgradesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineScaleSetRollingUpgradesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetRollingUpgrades to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetRollingUpgradesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> startOSUpgrade( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> startExtensionUpgrade( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getLatest( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> cancelWithResponseAsync(String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> cancelWithResponseAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String vmScaleSetName) { + Mono>> mono = cancelWithResponseAsync(resourceGroupName, vmScaleSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = cancelWithResponseAsync(resourceGroupName, vmScaleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancel(String resourceGroupName, String vmScaleSetName) { + return beginCancelAsync(resourceGroupName, vmScaleSetName).getSyncPoller(); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancel( + String resourceGroupName, String vmScaleSetName, Context context) { + return beginCancelAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller(); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cancelAsync(String resourceGroupName, String vmScaleSetName) { + return beginCancelAsync(resourceGroupName, vmScaleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cancelAsync(String resourceGroupName, String vmScaleSetName, Context context) { + return beginCancelAsync(resourceGroupName, vmScaleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cancel(String resourceGroupName, String vmScaleSetName) { + cancelAsync(resourceGroupName, vmScaleSetName).block(); + } + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 cancel(String resourceGroupName, String vmScaleSetName, Context context) { + cancelAsync(resourceGroupName, vmScaleSetName, context).block(); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> startOSUpgradeWithResponseAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .startOSUpgrade( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> startOSUpgradeWithResponseAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .startOSUpgrade( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartOSUpgradeAsync( + String resourceGroupName, String vmScaleSetName) { + Mono>> mono = startOSUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartOSUpgradeAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startOSUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartOSUpgrade(String resourceGroupName, String vmScaleSetName) { + return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName).getSyncPoller(); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartOSUpgrade( + String resourceGroupName, String vmScaleSetName, Context context) { + return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller(); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) { + return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startOSUpgradeAsync(String resourceGroupName, String vmScaleSetName, Context context) { + return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startOSUpgrade(String resourceGroupName, String vmScaleSetName) { + startOSUpgradeAsync(resourceGroupName, vmScaleSetName).block(); + } + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startOSUpgrade(String resourceGroupName, String vmScaleSetName, Context context) { + startOSUpgradeAsync(resourceGroupName, vmScaleSetName, context).block(); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> startExtensionUpgradeWithResponseAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .startExtensionUpgrade( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> startExtensionUpgradeWithResponseAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .startExtensionUpgrade( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartExtensionUpgradeAsync( + String resourceGroupName, String vmScaleSetName) { + Mono>> mono = + startExtensionUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartExtensionUpgradeAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startExtensionUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartExtensionUpgrade( + String resourceGroupName, String vmScaleSetName) { + return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).getSyncPoller(); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartExtensionUpgrade( + String resourceGroupName, String vmScaleSetName, Context context) { + return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller(); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startExtensionUpgradeAsync(String resourceGroupName, String vmScaleSetName) { + return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startExtensionUpgradeAsync(String resourceGroupName, String vmScaleSetName, Context context) { + return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName) { + startExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).block(); + } + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName, Context context) { + startExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context).block(); + } + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLatestWithResponseAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getLatest( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLatestWithResponseAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getLatest( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getLatestAsync(String resourceGroupName, String vmScaleSetName) { + return getLatestWithResponseAsync(resourceGroupName, vmScaleSetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RollingUpgradeStatusInfoInner getLatest(String resourceGroupName, String vmScaleSetName) { + return getLatestAsync(resourceGroupName, vmScaleSetName).block(); + } + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLatestWithResponse( + String resourceGroupName, String vmScaleSetName, Context context) { + return getLatestWithResponseAsync(resourceGroupName, vmScaleSetName, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesImpl.java new file mode 100644 index 0000000000000..e0e0be96d769c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetRollingUpgradesImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetRollingUpgradesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RollingUpgradeStatusInfoInner; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradeStatusInfo; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetRollingUpgrades; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetRollingUpgradesImpl implements VirtualMachineScaleSetRollingUpgrades { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetRollingUpgradesImpl.class); + + private final VirtualMachineScaleSetRollingUpgradesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetRollingUpgradesImpl( + VirtualMachineScaleSetRollingUpgradesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void cancel(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().cancel(resourceGroupName, vmScaleSetName); + } + + public void cancel(String resourceGroupName, String vmScaleSetName, Context context) { + this.serviceClient().cancel(resourceGroupName, vmScaleSetName, context); + } + + public void startOSUpgrade(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().startOSUpgrade(resourceGroupName, vmScaleSetName); + } + + public void startOSUpgrade(String resourceGroupName, String vmScaleSetName, Context context) { + this.serviceClient().startOSUpgrade(resourceGroupName, vmScaleSetName, context); + } + + public void startExtensionUpgrade(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().startExtensionUpgrade(resourceGroupName, vmScaleSetName); + } + + public void startExtensionUpgrade(String resourceGroupName, String vmScaleSetName, Context context) { + this.serviceClient().startExtensionUpgrade(resourceGroupName, vmScaleSetName, context); + } + + public RollingUpgradeStatusInfo getLatest(String resourceGroupName, String vmScaleSetName) { + RollingUpgradeStatusInfoInner inner = this.serviceClient().getLatest(resourceGroupName, vmScaleSetName); + if (inner != null) { + return new RollingUpgradeStatusInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getLatestWithResponse( + String resourceGroupName, String vmScaleSetName, Context context) { + Response inner = + this.serviceClient().getLatestWithResponse(resourceGroupName, vmScaleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RollingUpgradeStatusInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private VirtualMachineScaleSetRollingUpgradesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetSkuImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetSkuImpl.java new file mode 100644 index 0000000000000..6045819a7677c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetSkuImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetSku; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetSkuCapacity; + +public final class VirtualMachineScaleSetSkuImpl implements VirtualMachineScaleSetSku { + private VirtualMachineScaleSetSkuInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetSkuImpl( + VirtualMachineScaleSetSkuInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public VirtualMachineScaleSetSkuCapacity capacity() { + return this.innerModel().capacity(); + } + + public VirtualMachineScaleSetSkuInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionImpl.java new file mode 100644 index 0000000000000..e165f68cde3c3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionUpdate; + +public final class VirtualMachineScaleSetVMExtensionImpl + implements VirtualMachineScaleSetVMExtension, + VirtualMachineScaleSetVMExtension.Definition, + VirtualMachineScaleSetVMExtension.Update { + private VirtualMachineScaleSetVMExtensionInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String typeHandlerVersion() { + return this.innerModel().typeHandlerVersion(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public Boolean enableAutomaticUpgrade() { + return this.innerModel().enableAutomaticUpgrade(); + } + + public Object settings() { + return this.innerModel().settings(); + } + + public Object protectedSettings() { + return this.innerModel().protectedSettings(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineExtensionInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Boolean suppressFailures() { + return this.innerModel().suppressFailures(); + } + + public Object protectedSettingsFromKeyVault() { + return this.innerModel().protectedSettingsFromKeyVault(); + } + + public VirtualMachineScaleSetVMExtensionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmScaleSetName; + + private String instanceId; + + private String vmExtensionName; + + private VirtualMachineScaleSetVMExtensionUpdate updateExtensionParameters; + + public VirtualMachineScaleSetVMExtensionImpl withExistingVirtualMachine( + String resourceGroupName, String vmScaleSetName, String instanceId) { + this.resourceGroupName = resourceGroupName; + this.vmScaleSetName = vmScaleSetName; + this.instanceId = instanceId; + return this; + } + + public VirtualMachineScaleSetVMExtension create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .createOrUpdate( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineScaleSetVMExtension create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .createOrUpdate( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, this.innerModel(), context); + return this; + } + + VirtualMachineScaleSetVMExtensionImpl( + String name, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = new VirtualMachineScaleSetVMExtensionInner(); + this.serviceManager = serviceManager; + this.vmExtensionName = name; + } + + public VirtualMachineScaleSetVMExtensionImpl update() { + this.updateExtensionParameters = new VirtualMachineScaleSetVMExtensionUpdate(); + return this; + } + + public VirtualMachineScaleSetVMExtension apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .update( + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + updateExtensionParameters, + Context.NONE); + return this; + } + + public VirtualMachineScaleSetVMExtension apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .update( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, updateExtensionParameters, context); + return this; + } + + VirtualMachineScaleSetVMExtensionImpl( + VirtualMachineScaleSetVMExtensionInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmScaleSetName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachineScaleSets"); + this.instanceId = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + this.vmExtensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public VirtualMachineScaleSetVMExtension refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .getWithResponse( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineScaleSetVMExtension refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .getWithResponse(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, localExpand, context) + .getValue(); + return this; + } + + public VirtualMachineScaleSetVMExtensionImpl withForceUpdateTag(String forceUpdateTag) { + if (isInCreateMode()) { + this.innerModel().withForceUpdateTag(forceUpdateTag); + return this; + } else { + this.updateExtensionParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withPublisher(String publisher) { + if (isInCreateMode()) { + this.innerModel().withPublisher(publisher); + return this; + } else { + this.updateExtensionParameters.withPublisher(publisher); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withTypePropertiesType(String typePropertiesType) { + if (isInCreateMode()) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } else { + this.updateExtensionParameters.withTypePropertiesType(typePropertiesType); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withTypeHandlerVersion(String typeHandlerVersion) { + if (isInCreateMode()) { + this.innerModel().withTypeHandlerVersion(typeHandlerVersion); + return this; + } else { + this.updateExtensionParameters.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (isInCreateMode()) { + this.innerModel().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } else { + this.updateExtensionParameters.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (isInCreateMode()) { + this.innerModel().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } else { + this.updateExtensionParameters.withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withSettings(Object settings) { + if (isInCreateMode()) { + this.innerModel().withSettings(settings); + return this; + } else { + this.updateExtensionParameters.withSettings(settings); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withProtectedSettings(Object protectedSettings) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettings(protectedSettings); + return this; + } else { + this.updateExtensionParameters.withProtectedSettings(protectedSettings); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withInstanceView(VirtualMachineExtensionInstanceView instanceView) { + this.innerModel().withInstanceView(instanceView); + return this; + } + + public VirtualMachineScaleSetVMExtensionImpl withSuppressFailures(Boolean suppressFailures) { + if (isInCreateMode()) { + this.innerModel().withSuppressFailures(suppressFailures); + return this; + } else { + this.updateExtensionParameters.withSuppressFailures(suppressFailures); + return this; + } + } + + public VirtualMachineScaleSetVMExtensionImpl withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } else { + this.updateExtensionParameters.withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsClientImpl.java new file mode 100644 index 0000000000000..a9db82e02bb50 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsClientImpl.java @@ -0,0 +1,1609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.polling.PollResult; +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.compute.generated.fluent.VirtualMachineScaleSetVMExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionUpdate; +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 VirtualMachineScaleSetVMExtensionsClient. + */ +public final class VirtualMachineScaleSetVMExtensionsClientImpl implements VirtualMachineScaleSetVMExtensionsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetVMExtensionsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetVMExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetVMExtensionsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineScaleSetVMExtensionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetVMExtensions to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetVMExtensionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMExtensionInner extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("vmExtensionName") String vmExtensionName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMExtensionInner.class, + VirtualMachineScaleSetVMExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMExtensionInner.class, + VirtualMachineScaleSetVMExtensionInner.class, + context); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters) + .getSyncPoller(); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters) + .block(); + } + + /** + * The operation to create or update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionInner extensionParameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .block(); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMExtensionInner> + beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMExtensionInner.class, + VirtualMachineScaleSetVMExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMExtensionInner> + beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMExtensionInner.class, + VirtualMachineScaleSetVMExtensionInner.class, + context); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters) + .getSyncPoller(); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMExtensionInner> + beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).block(); + } + + /** + * The operation to update the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + VirtualMachineScaleSetVMExtensionUpdate extensionParameters, + Context context) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, context) + .block(); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, String vmExtensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).getSyncPoller(); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context) + .getSyncPoller(); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).block(); + } + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context).block(); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (vmExtensionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter vmExtensionName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + vmExtensionName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, String expand) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionInner get( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + final String expand = null; + return getAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand).block(); + } + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, context) + .block(); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand) { + return listWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final String expand = null; + return listWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMExtensionsListResultInner list( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final String expand = null; + return listAsync(resourceGroupName, vmScaleSetName, instanceId, expand).block(); + } + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + return listWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand, context).block(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsImpl.java new file mode 100644 index 0000000000000..d90d2034e5f6a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetVMExtensionsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensions; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionsListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetVMExtensionsImpl implements VirtualMachineScaleSetVMExtensions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionsImpl.class); + + private final VirtualMachineScaleSetVMExtensionsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetVMExtensionsImpl( + VirtualMachineScaleSetVMExtensionsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName); + } + + public void delete( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName, Context context) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context); + } + + public VirtualMachineScaleSetVMExtension get( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName) { + VirtualMachineScaleSetVMExtensionInner inner = + this.serviceClient().get(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName); + if (inner != null) { + return new VirtualMachineScaleSetVMExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetVMExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineScaleSetVMExtensionsListResult list( + String resourceGroupName, String vmScaleSetName, String instanceId) { + VirtualMachineScaleSetVMExtensionsListResultInner inner = + this.serviceClient().list(resourceGroupName, vmScaleSetName, instanceId); + if (inner != null) { + return new VirtualMachineScaleSetVMExtensionsListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, vmScaleSetName, instanceId, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetVMExtensionsListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineScaleSetVMExtension getById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String instanceId = Utils.getValueFromIdByName(id, "virtualMachines"); + if (instanceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + String localExpand = null; + return this + .getWithResponse(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String instanceId = Utils.getValueFromIdByName(id, "virtualMachines"); + if (instanceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String instanceId = Utils.getValueFromIdByName(id, "virtualMachines"); + if (instanceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + String instanceId = Utils.getValueFromIdByName(id, "virtualMachines"); + if (instanceId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String vmExtensionName = Utils.getValueFromIdByName(id, "extensions"); + if (vmExtensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, context); + } + + private VirtualMachineScaleSetVMExtensionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineScaleSetVMExtensionImpl define(String name) { + return new VirtualMachineScaleSetVMExtensionImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsListResultImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsListResultImpl.java new file mode 100644 index 0000000000000..ea371c33074da --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMExtensionsListResultImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtensionsListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class VirtualMachineScaleSetVMExtensionsListResultImpl + implements VirtualMachineScaleSetVMExtensionsListResult { + private VirtualMachineScaleSetVMExtensionsListResultInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetVMExtensionsListResultImpl( + VirtualMachineScaleSetVMExtensionsListResultInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineScaleSetVMExtensionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineScaleSetVMExtensionsListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMImpl.java new file mode 100644 index 0000000000000..1b1ea5000a46e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVM; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class VirtualMachineScaleSetVMImpl implements VirtualMachineScaleSetVM { + private VirtualMachineScaleSetVMInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetVMImpl( + VirtualMachineScaleSetVMInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager 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 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 String instanceId() { + return this.innerModel().instanceId(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public List resources() { + List inner = this.innerModel().resources(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new VirtualMachineExtensionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean latestModelApplied() { + return this.innerModel().latestModelApplied(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public VirtualMachineScaleSetVMInstanceView instanceView() { + VirtualMachineScaleSetVMInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new VirtualMachineScaleSetVMInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public SecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration() { + return this.innerModel().networkProfileConfiguration(); + } + + public DiagnosticsProfile diagnosticsProfile() { + return this.innerModel().diagnosticsProfile(); + } + + public SubResource availabilitySet() { + return this.innerModel().availabilitySet(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String licenseType() { + return this.innerModel().licenseType(); + } + + public String modelDefinitionApplied() { + return this.innerModel().modelDefinitionApplied(); + } + + public VirtualMachineScaleSetVMProtectionPolicy protectionPolicy() { + return this.innerModel().protectionPolicy(); + } + + public String userData() { + return this.innerModel().userData(); + } + + public VirtualMachineScaleSetVMInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMInstanceViewImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMInstanceViewImpl.java new file mode 100644 index 0000000000000..c3e76acd582d3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMInstanceViewImpl.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.BootDiagnosticsInstanceView; +import com.azure.resourcemanager.compute.generated.models.DiskInstanceView; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.MaintenanceRedeployStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAgentInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineHealthStatus; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceView; +import java.util.Collections; +import java.util.List; + +public final class VirtualMachineScaleSetVMInstanceViewImpl implements VirtualMachineScaleSetVMInstanceView { + private VirtualMachineScaleSetVMInstanceViewInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetVMInstanceViewImpl( + VirtualMachineScaleSetVMInstanceViewInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer platformUpdateDomain() { + return this.innerModel().platformUpdateDomain(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public String rdpThumbPrint() { + return this.innerModel().rdpThumbPrint(); + } + + public VirtualMachineAgentInstanceView vmAgent() { + return this.innerModel().vmAgent(); + } + + public MaintenanceRedeployStatus maintenanceRedeployStatus() { + return this.innerModel().maintenanceRedeployStatus(); + } + + public List disks() { + List inner = this.innerModel().disks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List extensions() { + List inner = this.innerModel().extensions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualMachineHealthStatus vmHealth() { + return this.innerModel().vmHealth(); + } + + public BootDiagnosticsInstanceView bootDiagnostics() { + return this.innerModel().bootDiagnostics(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String assignedHost() { + return this.innerModel().assignedHost(); + } + + public String placementGroupId() { + return this.innerModel().placementGroupId(); + } + + public VirtualMachineScaleSetVMInstanceViewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMPropertiesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMPropertiesImpl.java new file mode 100644 index 0000000000000..460a20fa9f014 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMPropertiesImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMPropertiesInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; + +public final class VirtualMachineScaleSetVMPropertiesImpl implements VirtualMachineScaleSetVMProperties { + private VirtualMachineScaleSetVMPropertiesInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineScaleSetVMPropertiesImpl( + VirtualMachineScaleSetVMPropertiesInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean latestModelApplied() { + return this.innerModel().latestModelApplied(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public VirtualMachineScaleSetVMInstanceView instanceView() { + VirtualMachineScaleSetVMInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new VirtualMachineScaleSetVMInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public SecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration() { + return this.innerModel().networkProfileConfiguration(); + } + + public DiagnosticsProfile diagnosticsProfile() { + return this.innerModel().diagnosticsProfile(); + } + + public SubResource availabilitySet() { + return this.innerModel().availabilitySet(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String licenseType() { + return this.innerModel().licenseType(); + } + + public String modelDefinitionApplied() { + return this.innerModel().modelDefinitionApplied(); + } + + public VirtualMachineScaleSetVMProtectionPolicy protectionPolicy() { + return this.innerModel().protectionPolicy(); + } + + public String userData() { + return this.innerModel().userData(); + } + + public VirtualMachineScaleSetVMPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsClientImpl.java new file mode 100644 index 0000000000000..c549e7d6a4c59 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsClientImpl.java @@ -0,0 +1,1709 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.VirtualMachineScaleSetVMRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandsListResult; +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 VirtualMachineScaleSetVMRunCommandsClient. + */ +public final class VirtualMachineScaleSetVMRunCommandsClientImpl implements VirtualMachineScaleSetVMRunCommandsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMRunCommandsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetVMRunCommandsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetVMRunCommandsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetVMRunCommandsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineScaleSetVMRunCommandsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetVMRunCommands to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetVMRunCommandsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineRunCommandInner runCommand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineRunCommandUpdate runCommand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("runCommandName") String runCommandName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @PathParam("runCommandName") String runCommandName, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("$expand") String expand, + @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(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + context); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand) + .getSyncPoller(); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginCreateOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context) + .getSyncPoller(); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).block(); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context) + .block(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 (runCommand == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommand is required and cannot be null.")); + } else { + runCommand.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + runCommand, + accept, + context); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + this.client.getContext()); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineRunCommandInner> beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineRunCommandInner.class, + VirtualMachineRunCommandInner.class, + context); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand) + .getSyncPoller(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineRunCommandInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context) + .getSyncPoller(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).block(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context).block(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, String runCommandName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, String runCommandName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).getSyncPoller(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, context).getSyncPoller(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).block(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName, Context context) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, context).block(); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + } + if (runCommandName == null) { + return Mono.error(new IllegalArgumentException("Parameter runCommandName 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + runCommandName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineRunCommandInner get( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + final String expand = null; + return getAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand).block(); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand, context) + .block(); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + 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())); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final String expand = null; + return new PagedIterable<>(listAsync(resourceGroupName, vmScaleSetName, instanceId, expand)); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, vmScaleSetName, instanceId, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response 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, text/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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsImpl.java new file mode 100644 index 0000000000000..733b86240a1b4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMRunCommandsImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetVMRunCommandsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommand; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMRunCommands; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetVMRunCommandsImpl implements VirtualMachineScaleSetVMRunCommands { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMRunCommandsImpl.class); + + private final VirtualMachineScaleSetVMRunCommandsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetVMRunCommandsImpl( + VirtualMachineScaleSetVMRunCommandsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachineRunCommand createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand) { + VirtualMachineRunCommandInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineRunCommand createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context) { + VirtualMachineRunCommandInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineRunCommand update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand) { + VirtualMachineRunCommandInner inner = + this.serviceClient().update(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineRunCommand update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context) { + VirtualMachineRunCommandInner inner = + this + .serviceClient() + .update(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand, context); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, runCommandName); + } + + public void delete( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, Context context) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, runCommandName, context); + } + + public VirtualMachineRunCommand get( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + VirtualMachineRunCommandInner inner = + this.serviceClient().get(resourceGroupName, vmScaleSetName, instanceId, runCommandName); + if (inner != null) { + return new VirtualMachineRunCommandImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineRunCommandImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, vmScaleSetName, instanceId); + return Utils.mapPage(inner, inner1 -> new VirtualMachineRunCommandImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, vmScaleSetName, instanceId, expand, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineRunCommandImpl(inner1, this.manager())); + } + + private VirtualMachineScaleSetVMRunCommandsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsClientImpl.java new file mode 100644 index 0000000000000..6ba552296d570 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsClientImpl.java @@ -0,0 +1,4608 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineScaleSetVMsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMListResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMReimageParameters; +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 VirtualMachineScaleSetVMsClient. */ +public final class VirtualMachineScaleSetVMsClientImpl implements VirtualMachineScaleSetVMsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetVMsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetVMsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetVMsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineScaleSetVMsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetVMs to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetVMsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimage( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimageAll( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deallocate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("forceDeletion") Boolean forceDeletion, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("$expand") InstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getInstanceView( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineScaleSetName") String virtualMachineScaleSetName, + @QueryParam("$filter") String filter, + @QueryParam("$select") String select, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> powerOff( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("skipShutdown") Boolean skipShutdown, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> redeploy( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> retrieveBootDiagnosticsData( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("sasUriExpirationTimeInMinutes") Integer sasUriExpirationTimeInMinutes, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> performMaintenance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> simulateEviction( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runCommand( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @PathParam("instanceId") String instanceId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RunCommandInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (vmScaleSetVMReimageInput != null) { + vmScaleSetVMReimageInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + vmScaleSetVMReimageInput, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (vmScaleSetVMReimageInput != null) { + vmScaleSetVMReimageInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + vmScaleSetVMReimageInput, + accept, + context); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput) + .getSyncPoller(); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context) + .getSyncPoller(); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null; + return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + reimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).block(); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String vmScaleSetName, String instanceId) { + final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null; + reimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).block(); + } + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + reimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context).block(); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageAllWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimageAll( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageAllWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimageAll( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAllAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = + reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAllAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAllAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAllAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId) { + reimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + reimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = + deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) { + deallocateAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + deallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMInner> beginUpdateAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMInner.class, + VirtualMachineScaleSetVMInner.class, + this.client.getContext()); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetVMInner> beginUpdateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetVMInner.class, + VirtualMachineScaleSetVMInner.class, + context); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).getSyncPoller(); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).getSyncPoller(); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMInner update( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).block(); + } + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMInner update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + return updateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).block(); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, Boolean forceDeletion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).getSyncPoller(); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context).getSyncPoller(); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId) { + final Boolean forceDeletion = null; + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).block(); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId) { + final Boolean forceDeletion = null; + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).block(); + } + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + deleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context).block(); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final InstanceViewTypes expand = null; + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMInner get(String resourceGroupName, String vmScaleSetName, String instanceId) { + final InstanceViewTypes expand = null; + return getAsync(resourceGroupName, vmScaleSetName, instanceId, expand).block(); + } + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 from a VM scale set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context) { + return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand, context).block(); + } + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInstanceViewAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetVMInstanceViewInner getInstanceView( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return getInstanceViewAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String virtualMachineScaleSetName, String filter, String select, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineScaleSetName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + virtualMachineScaleSetName, + filter, + select, + expand, + apiVersion, + 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 a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineScaleSetName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + virtualMachineScaleSetName, + filter, + select, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String virtualMachineScaleSetName, String filter, String select, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String virtualMachineScaleSetName) { + final String filter = null; + final String select = null; + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String virtualMachineScaleSetName) { + final String filter = null; + final String select = null; + final String expand = null; + return new PagedIterable<>(listAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand)); + } + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand, context)); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + Mono>> mono = + powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).getSyncPoller(); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context).getSyncPoller(); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + final Boolean skipShutdown = null; + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + powerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).block(); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) { + final Boolean skipShutdown = null; + powerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).block(); + } + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + powerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context).block(); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId) { + restartAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + restartAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = startWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId) { + return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId) { + startAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + startAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = + redeployWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + redeployWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName, String instanceId) { + redeployAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + redeployAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveBootDiagnosticsDataWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Integer sasUriExpirationTimeInMinutes) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveBootDiagnosticsData( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + sasUriExpirationTimeInMinutes, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveBootDiagnosticsDataWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + Integer sasUriExpirationTimeInMinutes, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveBootDiagnosticsData( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + sasUriExpirationTimeInMinutes, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveBootDiagnosticsDataAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Integer sasUriExpirationTimeInMinutes) { + return retrieveBootDiagnosticsDataWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveBootDiagnosticsDataAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final Integer sasUriExpirationTimeInMinutes = null; + return retrieveBootDiagnosticsDataWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetrieveBootDiagnosticsDataResultInner retrieveBootDiagnosticsData( + String resourceGroupName, String vmScaleSetName, String instanceId) { + final Integer sasUriExpirationTimeInMinutes = null; + return retrieveBootDiagnosticsDataAsync( + resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes) + .block(); + } + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + Integer sasUriExpirationTimeInMinutes, + Context context) { + return retrieveBootDiagnosticsDataWithResponseAsync( + resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes, context) + .block(); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + Mono>> mono = + performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller(); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller(); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId) { + performMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + performMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> simulateEvictionWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .simulateEviction( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> simulateEvictionWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .simulateEviction( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 simulateEvictionAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { + return simulateEvictionWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 simulateEviction(String resourceGroupName, String vmScaleSetName, String instanceId) { + simulateEvictionAsync(resourceGroupName, vmScaleSetName, instanceId).block(); + } + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simulateEvictionWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return simulateEvictionWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context).block(); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> runCommandWithResponseAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .runCommand( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> runCommandWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + } + if (instanceId == null) { + return Mono.error(new IllegalArgumentException("Parameter instanceId 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .runCommand( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + instanceId, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, RunCommandResultInner> beginRunCommandAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + Mono>> mono = + runCommandWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RunCommandResultInner.class, + RunCommandResultInner.class, + this.client.getContext()); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, RunCommandResultInner> beginRunCommandAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + runCommandWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RunCommandResultInner.class, RunCommandResultInner.class, context); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).getSyncPoller(); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).getSyncPoller(); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 runCommandAsync( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 runCommandAsync( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 RunCommandResultInner runCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + return runCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).block(); + } + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 RunCommandResultInner runCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + return runCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine Scale Set VMs operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine Scale Set VMs operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsImpl.java new file mode 100644 index 0000000000000..95ac12f011592 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetVMsImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetVMsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RetrieveBootDiagnosticsDataResult; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.RunCommandResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVM; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetVMsImpl implements VirtualMachineScaleSetVMs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMsImpl.class); + + private final VirtualMachineScaleSetVMsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetVMsImpl( + VirtualMachineScaleSetVMsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput); + } + + public void reimage(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName, instanceId); + } + + public void reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context); + } + + public void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().reimageAll(resourceGroupName, vmScaleSetName, instanceId); + } + + public void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().reimageAll(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().deallocate(resourceGroupName, vmScaleSetName, instanceId); + } + + public void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().deallocate(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public VirtualMachineScaleSetVM update( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) { + VirtualMachineScaleSetVMInner inner = + this.serviceClient().update(resourceGroupName, vmScaleSetName, instanceId, parameters); + if (inner != null) { + return new VirtualMachineScaleSetVMImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineScaleSetVM update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context) { + VirtualMachineScaleSetVMInner inner = + this.serviceClient().update(resourceGroupName, vmScaleSetName, instanceId, parameters, context); + if (inner != null) { + return new VirtualMachineScaleSetVMImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, forceDeletion); + } + + public void delete(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId); + } + + public void delete( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion, Context context) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context); + } + + public VirtualMachineScaleSetVM get(String resourceGroupName, String vmScaleSetName, String instanceId) { + VirtualMachineScaleSetVMInner inner = this.serviceClient().get(resourceGroupName, vmScaleSetName, instanceId); + if (inner != null) { + return new VirtualMachineScaleSetVMImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vmScaleSetName, instanceId, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetVMImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineScaleSetVMInstanceView getInstanceView( + String resourceGroupName, String vmScaleSetName, String instanceId) { + VirtualMachineScaleSetVMInstanceViewInner inner = + this.serviceClient().getInstanceView(resourceGroupName, vmScaleSetName, instanceId); + if (inner != null) { + return new VirtualMachineScaleSetVMInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + Response inner = + this.serviceClient().getInstanceViewWithResponse(resourceGroupName, vmScaleSetName, instanceId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetVMInstanceViewImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String virtualMachineScaleSetName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, virtualMachineScaleSetName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetVMImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, virtualMachineScaleSetName, filter, select, expand, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetVMImpl(inner1, this.manager())); + } + + public void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName, instanceId, skipShutdown); + } + + public void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName, instanceId); + } + + public void powerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context); + } + + public void restart(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().restart(resourceGroupName, vmScaleSetName, instanceId); + } + + public void restart(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().restart(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public void start(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().start(resourceGroupName, vmScaleSetName, instanceId); + } + + public void start(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().start(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().redeploy(resourceGroupName, vmScaleSetName, instanceId); + } + + public void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().redeploy(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData( + String resourceGroupName, String vmScaleSetName, String instanceId) { + RetrieveBootDiagnosticsDataResultInner inner = + this.serviceClient().retrieveBootDiagnosticsData(resourceGroupName, vmScaleSetName, instanceId); + if (inner != null) { + return new RetrieveBootDiagnosticsDataResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + Integer sasUriExpirationTimeInMinutes, + Context context) { + Response inner = + this + .serviceClient() + .retrieveBootDiagnosticsDataWithResponse( + resourceGroupName, vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RetrieveBootDiagnosticsDataResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().performMaintenance(resourceGroupName, vmScaleSetName, instanceId); + } + + public void performMaintenance( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + this.serviceClient().performMaintenance(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public void simulateEviction(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.serviceClient().simulateEviction(resourceGroupName, vmScaleSetName, instanceId); + } + + public Response simulateEvictionWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context) { + return this + .serviceClient() + .simulateEvictionWithResponse(resourceGroupName, vmScaleSetName, instanceId, context); + } + + public RunCommandResult runCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) { + RunCommandResultInner inner = + this.serviceClient().runCommand(resourceGroupName, vmScaleSetName, instanceId, parameters); + if (inner != null) { + return new RunCommandResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RunCommandResult runCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context) { + RunCommandResultInner inner = + this.serviceClient().runCommand(resourceGroupName, vmScaleSetName, instanceId, parameters, context); + if (inner != null) { + return new RunCommandResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private VirtualMachineScaleSetVMsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsClientImpl.java new file mode 100644 index 0000000000000..14c3fc8a25527 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsClientImpl.java @@ -0,0 +1,6805 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.polling.PollResult; +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.compute.generated.fluent.VirtualMachineScaleSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RecoveryWalkResponseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetVMScaleSets; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetListOSUpgradeHistory; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetListResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetListSkusResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetListWithLinkResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdate; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +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 VirtualMachineScaleSetsClient. */ +public final class VirtualMachineScaleSetsClientImpl implements VirtualMachineScaleSetsClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineScaleSetsService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineScaleSetsClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineScaleSetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineScaleSets to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineScaleSetsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("forceDeletion") Boolean forceDeletion, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") ExpandTypesForGetVMScaleSets expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/deallocate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deallocate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/delete") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deleteInstances( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("forceDeletion") Boolean forceDeletion, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/instanceView") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getInstanceView( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @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.Compute/virtualMachineScaleSets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listSkus( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getOSUpgradeHistory( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/poweroff") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> powerOff( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("skipShutdown") Boolean skipShutdown, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/redeploy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> redeploy( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> performMaintenance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> updateInstances( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/reimage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimage( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/reimageall") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimageAll( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> forceRecoveryServiceFabricPlatformUpdateDomainWalk( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("platformUpdateDomain") int platformUpdateDomain, + @QueryParam("zone") String zone, + @QueryParam("placementGroupId") String placementGroupId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> convertToSinglePlacementGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VMScaleSetConvertToSinglePlacementGroupInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> setOrchestrationServiceState( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmScaleSetName") String vmScaleSetName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") OrchestrationServiceStateInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listSkusNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getOSUpgradeHistoryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + location, + apiVersion, + 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 the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(listByLocationAsync(location)); + } + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(listByLocationAsync(location, context)); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetInner.class, + VirtualMachineScaleSetInner.class, + this.client.getContext()); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetInner.class, + VirtualMachineScaleSetInner.class, + context); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetInner> beginCreateOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).getSyncPoller(); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetInner> beginCreateOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, context).getSyncPoller(); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInner createOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters).block(); + } + + /** + * Create or update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInner createOrUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, context).block(); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetInner> beginUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetInner.class, + VirtualMachineScaleSetInner.class, + this.client.getContext()); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineScaleSetInner> beginUpdateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineScaleSetInner.class, + VirtualMachineScaleSetInner.class, + context); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters).getSyncPoller(); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineScaleSetInner> beginUpdate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, context).getSyncPoller(); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInner update( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { + return updateAsync(resourceGroupName, vmScaleSetName, parameters).block(); + } + + /** + * Update a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set to create or update. + * @param parameters The scale set object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInner update( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, Context context) { + return updateAsync(resourceGroupName, vmScaleSetName, parameters, context).block(); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, Boolean forceDeletion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmScaleSetName, Boolean forceDeletion, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, forceDeletion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmScaleSetName, forceDeletion, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).getSyncPoller(); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).getSyncPoller(); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName) { + final Boolean forceDeletion = null; + return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, Boolean forceDeletion) { + deleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).block(); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName) { + final Boolean forceDeletion = null; + deleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).block(); + } + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmScaleSetName, Boolean forceDeletion, Context context) { + deleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).block(); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + expand, + accept, + context); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmScaleSetName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vmScaleSetName) { + final ExpandTypesForGetVMScaleSets expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, vmScaleSetName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInner getByResourceGroup(String resourceGroupName, String vmScaleSetName) { + final ExpandTypesForGetVMScaleSets expand = null; + return getByResourceGroupAsync(resourceGroupName, vmScaleSetName, expand).block(); + } + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmScaleSetName, expand, context).block(); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginDeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + deallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + deallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + deallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteInstancesWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs == null) { + return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null.")); + } else { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteInstances( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deleteInstancesWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs == null) { + return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null.")); + } else { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteInstances( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + Mono>> mono = + deleteInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion) + .getSyncPoller(); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context) + .getSyncPoller(); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + final Boolean forceDeletion = null; + return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + deleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion).block(); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + final Boolean forceDeletion = null; + deleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion).block(); + } + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + deleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context).block(); + } + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInstanceViewWithResponseAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getInstanceView( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInstanceViewAsync( + String resourceGroupName, String vmScaleSetName) { + return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineScaleSetInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName) { + return getInstanceViewAsync(resourceGroupName, vmScaleSetName).block(); + } + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, Context context) { + return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, context).block(); + } + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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 a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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 a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusSinglePageAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSkus( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + 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 a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusSinglePageAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSkus( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusAsync(String resourceGroupName, String vmScaleSetName) { + return new PagedFlux<>( + () -> listSkusSinglePageAsync(resourceGroupName, vmScaleSetName), + nextLink -> listSkusNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedFlux<>( + () -> listSkusSinglePageAsync(resourceGroupName, vmScaleSetName, context), + nextLink -> listSkusNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkus(String resourceGroupName, String vmScaleSetName) { + return new PagedIterable<>(listSkusAsync(resourceGroupName, vmScaleSetName)); + } + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkus( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedIterable<>(listSkusAsync(resourceGroupName, vmScaleSetName, context)); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSUpgradeHistorySinglePageAsync( + String resourceGroupName, String vmScaleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOSUpgradeHistory( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + 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 list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSUpgradeHistorySinglePageAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOSUpgradeHistory( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getOSUpgradeHistoryAsync( + String resourceGroupName, String vmScaleSetName) { + return new PagedFlux<>( + () -> getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName), + nextLink -> getOSUpgradeHistoryNextSinglePageAsync(nextLink)); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getOSUpgradeHistoryAsync( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedFlux<>( + () -> getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName, context), + nextLink -> getOSUpgradeHistoryNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName) { + return new PagedIterable<>(getOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName)); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName, Context context) { + return new PagedIterable<>(getOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName, context)); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).getSyncPoller(); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context) + .getSyncPoller(); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String vmScaleSetName) { + final Boolean skipShutdown = null; + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + powerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).block(); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmScaleSetName) { + final Boolean skipShutdown = null; + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + powerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).block(); + } + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + powerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context).block(); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + restartWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + restartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + restartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + restartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + startWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + startAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + startAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + startAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + redeployWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + redeployWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + redeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + redeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + redeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + performMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + performMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + performMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> updateInstancesWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs == null) { + return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null.")); + } else { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateInstances( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> updateInstancesWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs == null) { + return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null.")); + } else { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateInstances( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpdateInstancesAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + Mono>> mono = + updateInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpdateInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + return beginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpdateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + return beginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 updateInstancesAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + return beginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 updateInstancesAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + return beginUpdateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 updateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + updateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 updateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + updateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmScaleSetReimageInput != null) { + vmScaleSetReimageInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmScaleSetReimageInput, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmScaleSetReimageInput != null) { + vmScaleSetReimageInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmScaleSetReimageInput, + accept, + context); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).getSyncPoller(); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context).getSyncPoller(); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = null; + return beginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + return beginReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + reimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).block(); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput = null; + reimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput).block(); + } + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + reimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context).block(); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageAllWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimageAll( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageAllWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (vmInstanceIDs != null) { + vmInstanceIDs.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimageAll( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + vmInstanceIDs, + accept, + context); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAllAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + Mono>> mono = + reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAllAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimageAll( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller(); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller(); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAllAsync( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAllAsync(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAllAsync( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + return beginReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAll( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + reimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAll(String resourceGroupName, String vmScaleSetName) { + final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; + reimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block(); + } + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + reimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block(); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .forceRecoveryServiceFabricPlatformUpdateDomainWalk( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + platformUpdateDomain, + zone, + placementGroupId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .forceRecoveryServiceFabricPlatformUpdateDomainWalk( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + platformUpdateDomain, + zone, + placementGroupId, + accept, + context); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceRecoveryServiceFabricPlatformUpdateDomainWalkAsync( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId) { + return forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponseAsync( + resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceRecoveryServiceFabricPlatformUpdateDomainWalkAsync( + String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) { + final String zone = null; + final String placementGroupId = null; + return forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponseAsync( + resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoveryWalkResponseInner forceRecoveryServiceFabricPlatformUpdateDomainWalk( + String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) { + final String zone = null; + final String placementGroupId = null; + return forceRecoveryServiceFabricPlatformUpdateDomainWalkAsync( + resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId) + .block(); + } + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId, + Context context) { + return forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponseAsync( + resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId, context) + .block(); + } + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> convertToSinglePlacementGroupWithResponseAsync( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .convertToSinglePlacementGroup( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> convertToSinglePlacementGroupWithResponseAsync( + String resourceGroupName, + String vmScaleSetName, + VMScaleSetConvertToSinglePlacementGroupInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .convertToSinglePlacementGroup( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToSinglePlacementGroupAsync( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters) { + return convertToSinglePlacementGroupWithResponseAsync(resourceGroupName, vmScaleSetName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToSinglePlacementGroup( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters) { + convertToSinglePlacementGroupAsync(resourceGroupName, vmScaleSetName, parameters).block(); + } + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response convertToSinglePlacementGroupWithResponse( + String resourceGroupName, + String vmScaleSetName, + VMScaleSetConvertToSinglePlacementGroupInput parameters, + Context context) { + return convertToSinglePlacementGroupWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, context) + .block(); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> setOrchestrationServiceStateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .setOrchestrationServiceState( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> setOrchestrationServiceStateWithResponseAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmScaleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .setOrchestrationServiceState( + this.client.getEndpoint(), + resourceGroupName, + vmScaleSetName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSetOrchestrationServiceStateAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + Mono>> mono = + setOrchestrationServiceStateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSetOrchestrationServiceStateAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + setOrchestrationServiceStateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSetOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + return beginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).getSyncPoller(); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSetOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + return beginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters, context) + .getSyncPoller(); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 setOrchestrationServiceStateAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + return beginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 setOrchestrationServiceStateAsync( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + return beginSetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + setOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters).block(); + } + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + setOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 Scale Set List Skus operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusNextSinglePageAsync(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.listSkusNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 Scale Set List Skus operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSkusNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Virtual Machine Scale Set OS Upgrade History operation response along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSUpgradeHistoryNextSinglePageAsync( + 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.getOSUpgradeHistoryNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Virtual Machine Scale Set OS Upgrade History operation response along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOSUpgradeHistoryNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOSUpgradeHistoryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsImpl.java new file mode 100644 index 0000000000000..7a48c09548f8a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineScaleSetsImpl.java @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachineScaleSetsClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RecoveryWalkResponseInner; +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetVMScaleSets; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; +import com.azure.resourcemanager.compute.generated.models.RecoveryWalkResponse; +import com.azure.resourcemanager.compute.generated.models.UpgradeOperationHistoricalStatusInfo; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSet; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetSku; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineScaleSetsImpl implements VirtualMachineScaleSets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetsImpl.class); + + private final VirtualMachineScaleSetsClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineScaleSetsImpl( + VirtualMachineScaleSetsClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String vmScaleSetName, Boolean forceDeletion) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, forceDeletion); + } + + public void delete(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName); + } + + public void delete(String resourceGroupName, String vmScaleSetName, Boolean forceDeletion, Context context) { + this.serviceClient().delete(resourceGroupName, vmScaleSetName, forceDeletion, context); + } + + public VirtualMachineScaleSet getByResourceGroup(String resourceGroupName, String vmScaleSetName) { + VirtualMachineScaleSetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vmScaleSetName); + if (inner != null) { + return new VirtualMachineScaleSetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deallocate( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().deallocate(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void deallocate(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().deallocate(resourceGroupName, vmScaleSetName); + } + + public void deallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().deallocate(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion) { + this.serviceClient().deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion); + } + + public void deleteInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + this.serviceClient().deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context) { + this.serviceClient().deleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context); + } + + public VirtualMachineScaleSetInstanceView getInstanceView(String resourceGroupName, String vmScaleSetName) { + VirtualMachineScaleSetInstanceViewInner inner = + this.serviceClient().getInstanceView(resourceGroupName, vmScaleSetName); + if (inner != null) { + return new VirtualMachineScaleSetInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, Context context) { + Response inner = + this.serviceClient().getInstanceViewWithResponse(resourceGroupName, vmScaleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineScaleSetInstanceViewImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable listSkus(String resourceGroupName, String vmScaleSetName) { + PagedIterable inner = + this.serviceClient().listSkus(resourceGroupName, vmScaleSetName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetSkuImpl(inner1, this.manager())); + } + + public PagedIterable listSkus( + String resourceGroupName, String vmScaleSetName, Context context) { + PagedIterable inner = + this.serviceClient().listSkus(resourceGroupName, vmScaleSetName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineScaleSetSkuImpl(inner1, this.manager())); + } + + public PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName) { + PagedIterable inner = + this.serviceClient().getOSUpgradeHistory(resourceGroupName, vmScaleSetName); + return Utils.mapPage(inner, inner1 -> new UpgradeOperationHistoricalStatusInfoImpl(inner1, this.manager())); + } + + public PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName, Context context) { + PagedIterable inner = + this.serviceClient().getOSUpgradeHistory(resourceGroupName, vmScaleSetName, context); + return Utils.mapPage(inner, inner1 -> new UpgradeOperationHistoricalStatusInfoImpl(inner1, this.manager())); + } + + public void powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs); + } + + public void powerOff(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName); + } + + public void powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().powerOff(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context); + } + + public void restart( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().restart(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void restart(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().restart(resourceGroupName, vmScaleSetName); + } + + public void restart( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().restart(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void start( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().start(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void start(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().start(resourceGroupName, vmScaleSetName); + } + + public void start( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().start(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void redeploy( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().redeploy(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void redeploy(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().redeploy(resourceGroupName, vmScaleSetName); + } + + public void redeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().redeploy(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void performMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().performMaintenance(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void performMaintenance(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().performMaintenance(resourceGroupName, vmScaleSetName); + } + + public void performMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().performMaintenance(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void updateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) { + this.serviceClient().updateInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void updateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context) { + this.serviceClient().updateInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public void reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput); + } + + public void reimage(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName); + } + + public void reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context) { + this.serviceClient().reimage(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, context); + } + + public void reimageAll( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) { + this.serviceClient().reimageAll(resourceGroupName, vmScaleSetName, vmInstanceIDs); + } + + public void reimageAll(String resourceGroupName, String vmScaleSetName) { + this.serviceClient().reimageAll(resourceGroupName, vmScaleSetName); + } + + public void reimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context) { + this.serviceClient().reimageAll(resourceGroupName, vmScaleSetName, vmInstanceIDs, context); + } + + public RecoveryWalkResponse forceRecoveryServiceFabricPlatformUpdateDomainWalk( + String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) { + RecoveryWalkResponseInner inner = + this + .serviceClient() + .forceRecoveryServiceFabricPlatformUpdateDomainWalk( + resourceGroupName, vmScaleSetName, platformUpdateDomain); + if (inner != null) { + return new RecoveryWalkResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId, + Context context) { + Response inner = + this + .serviceClient() + .forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + resourceGroupName, vmScaleSetName, platformUpdateDomain, zone, placementGroupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoveryWalkResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void convertToSinglePlacementGroup( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters) { + this.serviceClient().convertToSinglePlacementGroup(resourceGroupName, vmScaleSetName, parameters); + } + + public Response convertToSinglePlacementGroupWithResponse( + String resourceGroupName, + String vmScaleSetName, + VMScaleSetConvertToSinglePlacementGroupInput parameters, + Context context) { + return this + .serviceClient() + .convertToSinglePlacementGroupWithResponse(resourceGroupName, vmScaleSetName, parameters, context); + } + + public void setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters) { + this.serviceClient().setOrchestrationServiceState(resourceGroupName, vmScaleSetName, parameters); + } + + public void setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context) { + this.serviceClient().setOrchestrationServiceState(resourceGroupName, vmScaleSetName, parameters, context); + } + + public VirtualMachineScaleSet getById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + ExpandTypesForGetVMScaleSets localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, ExpandTypesForGetVMScaleSets expand, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + Boolean localForceDeletion = null; + this.delete(resourceGroupName, vmScaleSetName, localForceDeletion, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean forceDeletion, Context context) { + String resourceGroupName = Utils.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 vmScaleSetName = Utils.getValueFromIdByName(id, "virtualMachineScaleSets"); + if (vmScaleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineScaleSets'.", + id))); + } + this.delete(resourceGroupName, vmScaleSetName, forceDeletion, context); + } + + private VirtualMachineScaleSetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineScaleSetImpl define(String name) { + return new VirtualMachineScaleSetImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizeImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizeImpl.java new file mode 100644 index 0000000000000..ced2bf309289c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizeImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSize; + +public final class VirtualMachineSizeImpl implements VirtualMachineSize { + private VirtualMachineSizeInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineSizeImpl( + VirtualMachineSizeInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Integer numberOfCores() { + return this.innerModel().numberOfCores(); + } + + public Integer osDiskSizeInMB() { + return this.innerModel().osDiskSizeInMB(); + } + + public Integer resourceDiskSizeInMB() { + return this.innerModel().resourceDiskSizeInMB(); + } + + public Integer memoryInMB() { + return this.innerModel().memoryInMB(); + } + + public Integer maxDataDiskCount() { + return this.innerModel().maxDataDiskCount(); + } + + public VirtualMachineSizeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesClientImpl.java new file mode 100644 index 0000000000000..a39de392e12b7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesClientImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineSizesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineSizesClient. */ +public final class VirtualMachineSizesClientImpl implements VirtualMachineSizesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineSizesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineSizesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineSizesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineSizesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(VirtualMachineSizesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachineSizes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachineSizesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + location, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location) { + return new PagedFlux<>(() -> listSinglePageAsync(location)); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, context)); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location) { + return new PagedIterable<>(listAsync(location)); + } + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, Context context) { + return new PagedIterable<>(listAsync(location, context)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesImpl.java new file mode 100644 index 0000000000000..2d99badbe91b4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineSizesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachineSizesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSize; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineSizesImpl implements VirtualMachineSizes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineSizesImpl.class); + + private final VirtualMachineSizesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachineSizesImpl( + VirtualMachineSizesClient innerClient, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, Context context) { + PagedIterable inner = this.serviceClient().list(location, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + private VirtualMachineSizesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineUpdateImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineUpdateImpl.java new file mode 100644 index 0000000000000..3e9802b747bae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachineUpdateImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineUpdate; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineUpdateImpl implements VirtualMachineUpdate { + private VirtualMachineUpdateInner innerObject; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + VirtualMachineUpdateImpl( + VirtualMachineUpdateInner innerObject, + com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public VirtualMachineIdentity identity() { + return this.innerModel().identity(); + } + + public List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public AdditionalCapabilities additionalCapabilities() { + return this.innerModel().additionalCapabilities(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public SecurityProfile securityProfile() { + return this.innerModel().securityProfile(); + } + + public DiagnosticsProfile diagnosticsProfile() { + return this.innerModel().diagnosticsProfile(); + } + + public SubResource availabilitySet() { + return this.innerModel().availabilitySet(); + } + + public SubResource virtualMachineScaleSet() { + return this.innerModel().virtualMachineScaleSet(); + } + + public SubResource proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public VirtualMachinePriorityTypes priority() { + return this.innerModel().priority(); + } + + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.innerModel().evictionPolicy(); + } + + public BillingProfile billingProfile() { + return this.innerModel().billingProfile(); + } + + public SubResource host() { + return this.innerModel().host(); + } + + public SubResource hostGroup() { + return this.innerModel().hostGroup(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public VirtualMachineInstanceView instanceView() { + VirtualMachineInstanceViewInner inner = this.innerModel().instanceView(); + if (inner != null) { + return new VirtualMachineInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public String licenseType() { + return this.innerModel().licenseType(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String extensionsTimeBudget() { + return this.innerModel().extensionsTimeBudget(); + } + + public Integer platformFaultDomain() { + return this.innerModel().platformFaultDomain(); + } + + public ScheduledEventsProfile scheduledEventsProfile() { + return this.innerModel().scheduledEventsProfile(); + } + + public String userData() { + return this.innerModel().userData(); + } + + public CapacityReservationProfile capacityReservation() { + return this.innerModel().capacityReservation(); + } + + public ApplicationProfile applicationProfile() { + return this.innerModel().applicationProfile(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public VirtualMachineUpdateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesClientImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesClientImpl.java new file mode 100644 index 0000000000000..068206c3035b2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesClientImpl.java @@ -0,0 +1,6509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.compute.generated.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner; +import com.azure.resourcemanager.compute.generated.models.ApiErrorException; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineListResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeListResult; +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 VirtualMachinesClient. */ +public final class VirtualMachinesClientImpl implements VirtualMachinesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachinesService service; + + /** The service client containing this operation class. */ + private final ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachinesClientImpl(ComputeManagementClientImpl client) { + this.service = + RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeManagementClientVirtualMachines to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ComputeManagementCli") + private interface VirtualMachinesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/capture") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> capture( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineCaptureParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineUpdateInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("forceDeletion") Boolean forceDeletion, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("$expand") InstanceViewTypes expand, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/instanceView") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> instanceView( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/convertToManagedDisks") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> convertToManagedDisks( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/deallocate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> deallocate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("hibernate") Boolean hibernate, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/generalize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> generalize( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @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.Compute/virtualMachines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("statusOnly") String statusOnly, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/vmSizes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAvailableSizes( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/powerOff") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> powerOff( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("skipShutdown") Boolean skipShutdown, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/reapply") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reapply( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/redeploy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> redeploy( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/reimage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> reimage( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineReimageParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/retrieveBootDiagnosticsData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> retrieveBootDiagnosticsData( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("sasUriExpirationTimeInMinutes") Integer sasUriExpirationTimeInMinutes, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/performMaintenance") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> performMaintenance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/simulateEviction") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> simulateEviction( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/assessPatches") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> assessPatches( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/installPatches") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> installPatches( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VirtualMachineInstallPatchesParameters installPatchesInput, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" + + "/virtualMachines/{vmName}/runCommand") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runCommand( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmName") String vmName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RunCommandInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + location, + apiVersion, + 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 the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(location, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(listByLocationAsync(location)); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(listByLocationAsync(location, context)); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> captureWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .capture( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> captureWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .capture( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineCaptureResultInner> + beginCaptureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + Mono>> mono = captureWithResponseAsync(resourceGroupName, vmName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineCaptureResultInner.class, + VirtualMachineCaptureResultInner.class, + this.client.getContext()); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineCaptureResultInner> + beginCaptureAsync( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + captureWithResponseAsync(resourceGroupName, vmName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineCaptureResultInner.class, + VirtualMachineCaptureResultInner.class, + context); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineCaptureResultInner> beginCapture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + return beginCaptureAsync(resourceGroupName, vmName, parameters).getSyncPoller(); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineCaptureResultInner> beginCapture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + return beginCaptureAsync(resourceGroupName, vmName, parameters, context).getSyncPoller(); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono captureAsync( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + return beginCaptureAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono captureAsync( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + return beginCaptureAsync(resourceGroupName, vmName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineCaptureResultInner capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + return captureAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineCaptureResultInner capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + return captureAsync(resourceGroupName, vmName, parameters, context).block(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInner.class, + VirtualMachineInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters).getSyncPoller(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters, context).getSyncPoller(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner parameters) { + return createOrUpdateAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Create Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate( + String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, vmName, parameters, context).block(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, vmName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInner.class, + VirtualMachineInner.class, + this.client.getContext()); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginUpdateAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, vmName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return beginUpdateAsync(resourceGroupName, vmName, parameters).getSyncPoller(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) { + return beginUpdateAsync(resourceGroupName, vmName, parameters, context).getSyncPoller(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return beginUpdateAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) { + return beginUpdateAsync(resourceGroupName, vmName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return updateAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update( + String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) { + return updateAsync(resourceGroupName, vmName, parameters, context).block(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, Boolean forceDeletion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 vmName, Boolean forceDeletion, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + vmName, + forceDeletion, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, Boolean forceDeletion) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vmName, forceDeletion); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmName, Boolean forceDeletion, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmName, forceDeletion, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmName, forceDeletion).getSyncPoller(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmName, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, forceDeletion, context).getSyncPoller(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, Boolean forceDeletion) { + return beginDeleteAsync(resourceGroupName, vmName, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName) { + final Boolean forceDeletion = null; + return beginDeleteAsync(resourceGroupName, vmName, forceDeletion) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, Boolean forceDeletion, Context context) { + return beginDeleteAsync(resourceGroupName, vmName, forceDeletion, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, Boolean forceDeletion) { + deleteAsync(resourceGroupName, vmName, forceDeletion).block(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName) { + final Boolean forceDeletion = null; + deleteAsync(resourceGroupName, vmName, forceDeletion).block(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 vmName, Boolean forceDeletion, Context context) { + deleteAsync(resourceGroupName, vmName, forceDeletion, context).block(); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmName, InstanceViewTypes expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmName, InstanceViewTypes expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + vmName, + expand, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String vmName, InstanceViewTypes expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vmName) { + final InstanceViewTypes expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) { + final InstanceViewTypes expand = null; + return getByResourceGroupAsync(resourceGroupName, vmName, expand).block(); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmName, InstanceViewTypes expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand, context).block(); + } + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> instanceViewWithResponseAsync( + String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .instanceView( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> instanceViewWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .instanceView( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono instanceViewAsync(String resourceGroupName, String vmName) { + return instanceViewWithResponseAsync(resourceGroupName, vmName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceViewInner instanceView(String resourceGroupName, String vmName) { + return instanceViewAsync(resourceGroupName, vmName).block(); + } + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response instanceViewWithResponse( + String resourceGroupName, String vmName, Context context) { + return instanceViewWithResponseAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> convertToManagedDisksWithResponseAsync( + String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .convertToManagedDisks( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> convertToManagedDisksWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .convertToManagedDisks( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginConvertToManagedDisksAsync( + String resourceGroupName, String vmName) { + Mono>> mono = convertToManagedDisksWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginConvertToManagedDisksAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + convertToManagedDisksWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginConvertToManagedDisks(String resourceGroupName, String vmName) { + return beginConvertToManagedDisksAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginConvertToManagedDisks( + String resourceGroupName, String vmName, Context context) { + return beginConvertToManagedDisksAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToManagedDisksAsync(String resourceGroupName, String vmName) { + return beginConvertToManagedDisksAsync(resourceGroupName, vmName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToManagedDisksAsync(String resourceGroupName, String vmName, Context context) { + return beginConvertToManagedDisksAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToManagedDisks(String resourceGroupName, String vmName) { + convertToManagedDisksAsync(resourceGroupName, vmName).block(); + } + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 convertToManagedDisks(String resourceGroupName, String vmName, Context context) { + convertToManagedDisksAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, String vmName, Boolean hibernate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + hibernate, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> deallocateWithResponseAsync( + String resourceGroupName, String vmName, Boolean hibernate, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deallocate( + this.client.getEndpoint(), + resourceGroupName, + vmName, + hibernate, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, String vmName, Boolean hibernate) { + Mono>> mono = deallocateWithResponseAsync(resourceGroupName, vmName, hibernate); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeallocateAsync( + String resourceGroupName, String vmName, Boolean hibernate, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deallocateWithResponseAsync(resourceGroupName, vmName, hibernate, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmName, Boolean hibernate) { + return beginDeallocateAsync(resourceGroupName, vmName, hibernate).getSyncPoller(); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeallocate( + String resourceGroupName, String vmName, Boolean hibernate, Context context) { + return beginDeallocateAsync(resourceGroupName, vmName, hibernate, context).getSyncPoller(); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync(String resourceGroupName, String vmName, Boolean hibernate) { + return beginDeallocateAsync(resourceGroupName, vmName, hibernate) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync(String resourceGroupName, String vmName) { + final Boolean hibernate = null; + return beginDeallocateAsync(resourceGroupName, vmName, hibernate) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocateAsync(String resourceGroupName, String vmName, Boolean hibernate, Context context) { + return beginDeallocateAsync(resourceGroupName, vmName, hibernate, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmName, Boolean hibernate) { + deallocateAsync(resourceGroupName, vmName, hibernate).block(); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmName) { + final Boolean hibernate = null; + deallocateAsync(resourceGroupName, vmName, hibernate).block(); + } + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 deallocate(String resourceGroupName, String vmName, Boolean hibernate, Context context) { + deallocateAsync(resourceGroupName, vmName, hibernate, context).block(); + } + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> generalizeWithResponseAsync(String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generalize( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> generalizeWithResponseAsync(String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generalize( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 generalizeAsync(String resourceGroupName, String vmName) { + return generalizeWithResponseAsync(resourceGroupName, vmName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 generalize(String resourceGroupName, String vmName) { + generalizeAsync(resourceGroupName, vmName).block(); + } + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generalizeWithResponse(String resourceGroupName, String vmName, Context context) { + return generalizeWithResponseAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + apiVersion, + 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 machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String statusOnly, String filter) { + 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + statusOnly, + filter, + 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 machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String statusOnly, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + statusOnly, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String statusOnly, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(statusOnly, filter), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String statusOnly = null; + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(statusOnly, filter), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String statusOnly, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(statusOnly, filter, context), + nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String statusOnly = null; + final String filter = null; + return new PagedIterable<>(listAsync(statusOnly, filter)); + } + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String statusOnly, String filter, Context context) { + return new PagedIterable<>(listAsync(statusOnly, filter, context)); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableSizesSinglePageAsync( + String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAvailableSizes( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableSizesSinglePageAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAvailableSizes( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAvailableSizesAsync(String resourceGroupName, String vmName) { + return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, vmName)); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAvailableSizesAsync( + String resourceGroupName, String vmName, Context context) { + return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, vmName, context)); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAvailableSizes(String resourceGroupName, String vmName) { + return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, vmName)); + } + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAvailableSizes( + String resourceGroupName, String vmName, Context context) { + return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, vmName, context)); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String vmName, Boolean skipShutdown) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmName, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> powerOffWithResponseAsync( + String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .powerOff( + this.client.getEndpoint(), + resourceGroupName, + vmName, + skipShutdown, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, String vmName, Boolean skipShutdown) { + Mono>> mono = powerOffWithResponseAsync(resourceGroupName, vmName, skipShutdown); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPowerOffAsync( + String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + powerOffWithResponseAsync(resourceGroupName, vmName, skipShutdown, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmName, Boolean skipShutdown) { + return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown).getSyncPoller(); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPowerOff( + String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown, context).getSyncPoller(); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String vmName, Boolean skipShutdown) { + return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String vmName) { + final Boolean skipShutdown = null; + return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOffAsync(String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmName, Boolean skipShutdown) { + powerOffAsync(resourceGroupName, vmName, skipShutdown).block(); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmName) { + final Boolean skipShutdown = null; + powerOffAsync(resourceGroupName, vmName, skipShutdown).block(); + } + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 powerOff(String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + powerOffAsync(resourceGroupName, vmName, skipShutdown, context).block(); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reapplyWithResponseAsync(String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reapply( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reapplyWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reapply( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReapplyAsync(String resourceGroupName, String vmName) { + Mono>> mono = reapplyWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReapplyAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = reapplyWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReapply(String resourceGroupName, String vmName) { + return beginReapplyAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReapply(String resourceGroupName, String vmName, Context context) { + return beginReapplyAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reapplyAsync(String resourceGroupName, String vmName) { + return beginReapplyAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reapplyAsync(String resourceGroupName, String vmName, Context context) { + return beginReapplyAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reapply(String resourceGroupName, String vmName) { + reapplyAsync(resourceGroupName, vmName).block(); + } + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reapply(String resourceGroupName, String vmName, Context context) { + reapplyAsync(resourceGroupName, vmName, context).block(); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String vmName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String vmName) { + return beginRestartAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String vmName, Context context) { + return beginRestartAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName) { + return beginRestartAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName, Context context) { + return beginRestartAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName) { + restartAsync(resourceGroupName, vmName).block(); + } + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName, Context context) { + restartAsync(resourceGroupName, vmName, context).block(); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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 resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String vmName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String vmName) { + return beginStartAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String vmName, Context context) { + return beginStartAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName) { + return beginStartAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName, Context context) { + return beginStartAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName) { + startAsync(resourceGroupName, vmName).block(); + } + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 resourceGroupName, String vmName, Context context) { + startAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync(String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> redeployWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String vmName) { + Mono>> mono = redeployWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = redeployWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmName) { + return beginRedeployAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmName, Context context) { + return beginRedeployAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync(String resourceGroupName, String vmName) { + return beginRedeployAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeployAsync(String resourceGroupName, String vmName, Context context) { + return beginRedeployAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy(String resourceGroupName, String vmName) { + redeployAsync(resourceGroupName, vmName).block(); + } + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 redeploy(String resourceGroupName, String vmName, Context context) { + redeployAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> reimageWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters != null) { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .reimage( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + Mono>> mono = reimageWithResponseAsync(resourceGroupName, vmName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReimageAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + reimageWithResponseAsync(resourceGroupName, vmName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + return beginReimageAsync(resourceGroupName, vmName, parameters).getSyncPoller(); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + return beginReimageAsync(resourceGroupName, vmName, parameters, context).getSyncPoller(); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + return beginReimageAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync(String resourceGroupName, String vmName) { + final VirtualMachineReimageParameters parameters = null; + return beginReimageAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimageAsync( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + return beginReimageAsync(resourceGroupName, vmName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + reimageAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage(String resourceGroupName, String vmName) { + final VirtualMachineReimageParameters parameters = null; + reimageAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 reimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + reimageAsync(resourceGroupName, vmName, parameters, context).block(); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveBootDiagnosticsDataWithResponseAsync( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveBootDiagnosticsData( + this.client.getEndpoint(), + resourceGroupName, + vmName, + sasUriExpirationTimeInMinutes, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveBootDiagnosticsDataWithResponseAsync( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveBootDiagnosticsData( + this.client.getEndpoint(), + resourceGroupName, + vmName, + sasUriExpirationTimeInMinutes, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveBootDiagnosticsDataAsync( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes) { + return retrieveBootDiagnosticsDataWithResponseAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveBootDiagnosticsDataAsync( + String resourceGroupName, String vmName) { + final Integer sasUriExpirationTimeInMinutes = null; + return retrieveBootDiagnosticsDataWithResponseAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetrieveBootDiagnosticsDataResultInner retrieveBootDiagnosticsData(String resourceGroupName, String vmName) { + final Integer sasUriExpirationTimeInMinutes = null; + return retrieveBootDiagnosticsDataAsync(resourceGroupName, vmName, sasUriExpirationTimeInMinutes).block(); + } + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes, Context context) { + return retrieveBootDiagnosticsDataWithResponseAsync( + resourceGroupName, vmName, sasUriExpirationTimeInMinutes, context) + .block(); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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>> performMaintenanceWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .performMaintenance( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync(String resourceGroupName, String vmName) { + Mono>> mono = performMaintenanceWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPerformMaintenanceAsync( + String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = performMaintenanceWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance(String resourceGroupName, String vmName) { + return beginPerformMaintenanceAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPerformMaintenance( + String resourceGroupName, String vmName, Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync(String resourceGroupName, String vmName) { + return beginPerformMaintenanceAsync(resourceGroupName, vmName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenanceAsync(String resourceGroupName, String vmName, Context context) { + return beginPerformMaintenanceAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance(String resourceGroupName, String vmName) { + performMaintenanceAsync(resourceGroupName, vmName).block(); + } + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 performMaintenance(String resourceGroupName, String vmName, Context context) { + performMaintenanceAsync(resourceGroupName, vmName, context).block(); + } + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> simulateEvictionWithResponseAsync(String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .simulateEviction( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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> simulateEvictionWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .simulateEviction( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 simulateEvictionAsync(String resourceGroupName, String vmName) { + return simulateEvictionWithResponseAsync(resourceGroupName, vmName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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 simulateEviction(String resourceGroupName, String vmName) { + simulateEvictionAsync(resourceGroupName, vmName).block(); + } + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simulateEvictionWithResponse(String resourceGroupName, String vmName, Context context) { + return simulateEvictionWithResponseAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> assessPatchesWithResponseAsync(String resourceGroupName, String vmName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .assessPatches( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> assessPatchesWithResponseAsync( + String resourceGroupName, String vmName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .assessPatches( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineAssessPatchesResultInner> + beginAssessPatchesAsync(String resourceGroupName, String vmName) { + Mono>> mono = assessPatchesWithResponseAsync(resourceGroupName, vmName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineAssessPatchesResultInner.class, + VirtualMachineAssessPatchesResultInner.class, + this.client.getContext()); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineAssessPatchesResultInner> + beginAssessPatchesAsync(String resourceGroupName, String vmName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = assessPatchesWithResponseAsync(resourceGroupName, vmName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineAssessPatchesResultInner.class, + VirtualMachineAssessPatchesResultInner.class, + context); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineAssessPatchesResultInner> + beginAssessPatches(String resourceGroupName, String vmName) { + return beginAssessPatchesAsync(resourceGroupName, vmName).getSyncPoller(); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineAssessPatchesResultInner> + beginAssessPatches(String resourceGroupName, String vmName, Context context) { + return beginAssessPatchesAsync(resourceGroupName, vmName, context).getSyncPoller(); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono assessPatchesAsync(String resourceGroupName, String vmName) { + return beginAssessPatchesAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono assessPatchesAsync( + String resourceGroupName, String vmName, Context context) { + return beginAssessPatchesAsync(resourceGroupName, vmName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineAssessPatchesResultInner assessPatches(String resourceGroupName, String vmName) { + return assessPatchesAsync(resourceGroupName, vmName).block(); + } + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineAssessPatchesResultInner assessPatches( + String resourceGroupName, String vmName, Context context) { + return assessPatchesAsync(resourceGroupName, vmName, context).block(); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> installPatchesWithResponseAsync( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (installPatchesInput == null) { + return Mono + .error(new IllegalArgumentException("Parameter installPatchesInput is required and cannot be null.")); + } else { + installPatchesInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .installPatches( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + installPatchesInput, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> installPatchesWithResponseAsync( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (installPatchesInput == null) { + return Mono + .error(new IllegalArgumentException("Parameter installPatchesInput is required and cannot be null.")); + } else { + installPatchesInput.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .installPatches( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + installPatchesInput, + accept, + context); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInstallPatchesResultInner> + beginInstallPatchesAsync( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + Mono>> mono = + installPatchesWithResponseAsync(resourceGroupName, vmName, installPatchesInput); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInstallPatchesResultInner.class, + VirtualMachineInstallPatchesResultInner.class, + this.client.getContext()); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInstallPatchesResultInner> + beginInstallPatchesAsync( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + installPatchesWithResponseAsync(resourceGroupName, vmName, installPatchesInput, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInstallPatchesResultInner.class, + VirtualMachineInstallPatchesResultInner.class, + context); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstallPatchesResultInner> + beginInstallPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + return beginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput).getSyncPoller(); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstallPatchesResultInner> + beginInstallPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + return beginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput, context).getSyncPoller(); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono installPatchesAsync( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + return beginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono installPatchesAsync( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + return beginInstallPatchesAsync(resourceGroupName, vmName, installPatchesInput, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstallPatchesResultInner installPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + return installPatchesAsync(resourceGroupName, vmName, installPatchesInput).block(); + } + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstallPatchesResultInner installPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + return installPatchesAsync(resourceGroupName, vmName, installPatchesInput, context).block(); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> runCommandWithResponseAsync( + String resourceGroupName, String vmName, RunCommandInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .runCommand( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> runCommandWithResponseAsync( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01"; + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .runCommand( + this.client.getEndpoint(), + resourceGroupName, + vmName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, RunCommandResultInner> beginRunCommandAsync( + String resourceGroupName, String vmName, RunCommandInput parameters) { + Mono>> mono = runCommandWithResponseAsync(resourceGroupName, vmName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RunCommandResultInner.class, + RunCommandResultInner.class, + this.client.getContext()); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + private PollerFlux, RunCommandResultInner> beginRunCommandAsync( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + runCommandWithResponseAsync(resourceGroupName, vmName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RunCommandResultInner.class, RunCommandResultInner.class, context); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmName, RunCommandInput parameters) { + return beginRunCommandAsync(resourceGroupName, vmName, parameters).getSyncPoller(); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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.LONG_RUNNING_OPERATION) + public SyncPoller, RunCommandResultInner> beginRunCommand( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + return beginRunCommandAsync(resourceGroupName, vmName, parameters, context).getSyncPoller(); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 runCommandAsync( + String resourceGroupName, String vmName, RunCommandInput parameters) { + return beginRunCommandAsync(resourceGroupName, vmName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 runCommandAsync( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + return beginRunCommandAsync(resourceGroupName, vmName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 RunCommandResultInner runCommand(String resourceGroupName, String vmName, RunCommandInput parameters) { + return runCommandAsync(resourceGroupName, vmName, parameters).block(); + } + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 RunCommandResultInner runCommand( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + return runCommandAsync(resourceGroupName, vmName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(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.listByLocationNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesImpl.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesImpl.java new file mode 100644 index 0000000000000..2aae94cde42fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/VirtualMachinesImpl.java @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.azure.resourcemanager.compute.generated.models.InstanceViewTypes; +import com.azure.resourcemanager.compute.generated.models.RetrieveBootDiagnosticsDataResult; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import com.azure.resourcemanager.compute.generated.models.RunCommandResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachine; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineAssessPatchesResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesResult; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstanceView; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSize; +import com.azure.resourcemanager.compute.generated.models.VirtualMachines; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachinesImpl implements VirtualMachines { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachinesImpl.class); + + private final VirtualMachinesClient innerClient; + + private final com.azure.resourcemanager.compute.generated.ComputeManager serviceManager; + + public VirtualMachinesImpl( + VirtualMachinesClient innerClient, com.azure.resourcemanager.compute.generated.ComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(location, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public VirtualMachineCaptureResult capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + VirtualMachineCaptureResultInner inner = this.serviceClient().capture(resourceGroupName, vmName, parameters); + if (inner != null) { + return new VirtualMachineCaptureResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineCaptureResult capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) { + VirtualMachineCaptureResultInner inner = + this.serviceClient().capture(resourceGroupName, vmName, parameters, context); + if (inner != null) { + return new VirtualMachineCaptureResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmName, Boolean forceDeletion) { + this.serviceClient().delete(resourceGroupName, vmName, forceDeletion); + } + + public void delete(String resourceGroupName, String vmName) { + this.serviceClient().delete(resourceGroupName, vmName); + } + + public void delete(String resourceGroupName, String vmName, Boolean forceDeletion, Context context) { + this.serviceClient().delete(resourceGroupName, vmName, forceDeletion, context); + } + + public VirtualMachine getByResourceGroup(String resourceGroupName, String vmName) { + VirtualMachineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vmName); + if (inner != null) { + return new VirtualMachineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmName, InstanceViewTypes expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vmName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineInstanceView instanceView(String resourceGroupName, String vmName) { + VirtualMachineInstanceViewInner inner = this.serviceClient().instanceView(resourceGroupName, vmName); + if (inner != null) { + return new VirtualMachineInstanceViewImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response instanceViewWithResponse( + String resourceGroupName, String vmName, Context context) { + Response inner = + this.serviceClient().instanceViewWithResponse(resourceGroupName, vmName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineInstanceViewImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void convertToManagedDisks(String resourceGroupName, String vmName) { + this.serviceClient().convertToManagedDisks(resourceGroupName, vmName); + } + + public void convertToManagedDisks(String resourceGroupName, String vmName, Context context) { + this.serviceClient().convertToManagedDisks(resourceGroupName, vmName, context); + } + + public void deallocate(String resourceGroupName, String vmName, Boolean hibernate) { + this.serviceClient().deallocate(resourceGroupName, vmName, hibernate); + } + + public void deallocate(String resourceGroupName, String vmName) { + this.serviceClient().deallocate(resourceGroupName, vmName); + } + + public void deallocate(String resourceGroupName, String vmName, Boolean hibernate, Context context) { + this.serviceClient().deallocate(resourceGroupName, vmName, hibernate, context); + } + + public void generalize(String resourceGroupName, String vmName) { + this.serviceClient().generalize(resourceGroupName, vmName); + } + + public Response generalizeWithResponse(String resourceGroupName, String vmName, Context context) { + return this.serviceClient().generalizeWithResponse(resourceGroupName, vmName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable list(String statusOnly, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(statusOnly, filter, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable listAvailableSizes(String resourceGroupName, String vmName) { + PagedIterable inner = + this.serviceClient().listAvailableSizes(resourceGroupName, vmName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + public PagedIterable listAvailableSizes( + String resourceGroupName, String vmName, Context context) { + PagedIterable inner = + this.serviceClient().listAvailableSizes(resourceGroupName, vmName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineSizeImpl(inner1, this.manager())); + } + + public void powerOff(String resourceGroupName, String vmName, Boolean skipShutdown) { + this.serviceClient().powerOff(resourceGroupName, vmName, skipShutdown); + } + + public void powerOff(String resourceGroupName, String vmName) { + this.serviceClient().powerOff(resourceGroupName, vmName); + } + + public void powerOff(String resourceGroupName, String vmName, Boolean skipShutdown, Context context) { + this.serviceClient().powerOff(resourceGroupName, vmName, skipShutdown, context); + } + + public void reapply(String resourceGroupName, String vmName) { + this.serviceClient().reapply(resourceGroupName, vmName); + } + + public void reapply(String resourceGroupName, String vmName, Context context) { + this.serviceClient().reapply(resourceGroupName, vmName, context); + } + + public void restart(String resourceGroupName, String vmName) { + this.serviceClient().restart(resourceGroupName, vmName); + } + + public void restart(String resourceGroupName, String vmName, Context context) { + this.serviceClient().restart(resourceGroupName, vmName, context); + } + + public void start(String resourceGroupName, String vmName) { + this.serviceClient().start(resourceGroupName, vmName); + } + + public void start(String resourceGroupName, String vmName, Context context) { + this.serviceClient().start(resourceGroupName, vmName, context); + } + + public void redeploy(String resourceGroupName, String vmName) { + this.serviceClient().redeploy(resourceGroupName, vmName); + } + + public void redeploy(String resourceGroupName, String vmName, Context context) { + this.serviceClient().redeploy(resourceGroupName, vmName, context); + } + + public void reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters) { + this.serviceClient().reimage(resourceGroupName, vmName, parameters); + } + + public void reimage(String resourceGroupName, String vmName) { + this.serviceClient().reimage(resourceGroupName, vmName); + } + + public void reimage( + String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context) { + this.serviceClient().reimage(resourceGroupName, vmName, parameters, context); + } + + public RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData(String resourceGroupName, String vmName) { + RetrieveBootDiagnosticsDataResultInner inner = + this.serviceClient().retrieveBootDiagnosticsData(resourceGroupName, vmName); + if (inner != null) { + return new RetrieveBootDiagnosticsDataResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes, Context context) { + Response inner = + this + .serviceClient() + .retrieveBootDiagnosticsDataWithResponse( + resourceGroupName, vmName, sasUriExpirationTimeInMinutes, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RetrieveBootDiagnosticsDataResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void performMaintenance(String resourceGroupName, String vmName) { + this.serviceClient().performMaintenance(resourceGroupName, vmName); + } + + public void performMaintenance(String resourceGroupName, String vmName, Context context) { + this.serviceClient().performMaintenance(resourceGroupName, vmName, context); + } + + public void simulateEviction(String resourceGroupName, String vmName) { + this.serviceClient().simulateEviction(resourceGroupName, vmName); + } + + public Response simulateEvictionWithResponse(String resourceGroupName, String vmName, Context context) { + return this.serviceClient().simulateEvictionWithResponse(resourceGroupName, vmName, context); + } + + public VirtualMachineAssessPatchesResult assessPatches(String resourceGroupName, String vmName) { + VirtualMachineAssessPatchesResultInner inner = this.serviceClient().assessPatches(resourceGroupName, vmName); + if (inner != null) { + return new VirtualMachineAssessPatchesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineAssessPatchesResult assessPatches(String resourceGroupName, String vmName, Context context) { + VirtualMachineAssessPatchesResultInner inner = + this.serviceClient().assessPatches(resourceGroupName, vmName, context); + if (inner != null) { + return new VirtualMachineAssessPatchesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstallPatchesResult installPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput) { + VirtualMachineInstallPatchesResultInner inner = + this.serviceClient().installPatches(resourceGroupName, vmName, installPatchesInput); + if (inner != null) { + return new VirtualMachineInstallPatchesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstallPatchesResult installPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context) { + VirtualMachineInstallPatchesResultInner inner = + this.serviceClient().installPatches(resourceGroupName, vmName, installPatchesInput, context); + if (inner != null) { + return new VirtualMachineInstallPatchesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RunCommandResult runCommand(String resourceGroupName, String vmName, RunCommandInput parameters) { + RunCommandResultInner inner = this.serviceClient().runCommand(resourceGroupName, vmName, parameters); + if (inner != null) { + return new RunCommandResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RunCommandResult runCommand( + String resourceGroupName, String vmName, RunCommandInput parameters, Context context) { + RunCommandResultInner inner = this.serviceClient().runCommand(resourceGroupName, vmName, parameters, context); + if (inner != null) { + return new RunCommandResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachine getById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + InstanceViewTypes localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, vmName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + Boolean localForceDeletion = null; + this.delete(resourceGroupName, vmName, localForceDeletion, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean forceDeletion, Context context) { + String resourceGroupName = Utils.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 vmName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + this.delete(resourceGroupName, vmName, forceDeletion, context); + } + + private VirtualMachinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.compute.generated.ComputeManager manager() { + return this.serviceManager; + } + + public VirtualMachineImpl define(String name) { + return new VirtualMachineImpl(name, this.manager()); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/package-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/package-info.java new file mode 100644 index 0000000000000..8568e6069f5c8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ComputeManagementClient. Compute Client. */ +package com.azure.resourcemanager.compute.generated.implementation; diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessLevel.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessLevel.java new file mode 100644 index 0000000000000..6edbbea1fea15 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessLevel.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccessLevel. */ +public final class AccessLevel extends ExpandableStringEnum { + /** Static value None for AccessLevel. */ + public static final AccessLevel NONE = fromString("None"); + + /** Static value Read for AccessLevel. */ + public static final AccessLevel READ = fromString("Read"); + + /** Static value Write for AccessLevel. */ + public static final AccessLevel WRITE = fromString("Write"); + + /** + * Creates or finds a AccessLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessLevel. + */ + @JsonCreator + public static AccessLevel fromString(String name) { + return fromString(name, AccessLevel.class); + } + + /** @return known AccessLevel values. */ + public static Collection values() { + return values(AccessLevel.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessUri.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessUri.java new file mode 100644 index 0000000000000..9c5bfb05d00ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AccessUri.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner; + +/** An immutable client-side representation of AccessUri. */ +public interface AccessUri { + /** + * Gets the accessSas property: A SAS uri for accessing a disk. + * + * @return the accessSas value. + */ + String accessSas(); + + /** + * Gets the securityDataAccessSas property: A SAS uri for accessing a VM guest state. + * + * @return the securityDataAccessSas value. + */ + String securityDataAccessSas(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.AccessUriInner object. + * + * @return the inner object. + */ + AccessUriInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalCapabilities.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalCapabilities.java new file mode 100644 index 0000000000000..f522acba7733b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalCapabilities.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Enables or disables a capability on the virtual machine or virtual machine scale set. */ +@Fluent +public final class AdditionalCapabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdditionalCapabilities.class); + + /* + * The flag that enables or disables a capability to have one or more + * managed data disks with UltraSSD_LRS storage account type on the VM or + * VMSS. Managed disks with storage account type UltraSSD_LRS can be added + * to a virtual machine or virtual machine scale set only if this property + * is enabled. + */ + @JsonProperty(value = "ultraSSDEnabled") + private Boolean ultraSsdEnabled; + + /* + * The flag that enables or disables hibernation capability on the VM. + */ + @JsonProperty(value = "hibernationEnabled") + private Boolean hibernationEnabled; + + /** + * Get the ultraSsdEnabled property: The flag that enables or disables a capability to have one or more managed data + * disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type + * UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. + * + * @return the ultraSsdEnabled value. + */ + public Boolean ultraSsdEnabled() { + return this.ultraSsdEnabled; + } + + /** + * Set the ultraSsdEnabled property: The flag that enables or disables a capability to have one or more managed data + * disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type + * UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. + * + * @param ultraSsdEnabled the ultraSsdEnabled value to set. + * @return the AdditionalCapabilities object itself. + */ + public AdditionalCapabilities withUltraSsdEnabled(Boolean ultraSsdEnabled) { + this.ultraSsdEnabled = ultraSsdEnabled; + return this; + } + + /** + * Get the hibernationEnabled property: The flag that enables or disables hibernation capability on the VM. + * + * @return the hibernationEnabled value. + */ + public Boolean hibernationEnabled() { + return this.hibernationEnabled; + } + + /** + * Set the hibernationEnabled property: The flag that enables or disables hibernation capability on the VM. + * + * @param hibernationEnabled the hibernationEnabled value to set. + * @return the AdditionalCapabilities object itself. + */ + public AdditionalCapabilities withHibernationEnabled(Boolean hibernationEnabled) { + this.hibernationEnabled = hibernationEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalUnattendContent.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalUnattendContent.java new file mode 100644 index 0000000000000..c0d8203413c04 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AdditionalUnattendContent.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies additional XML formatted information that can be included in the Unattend.xml file, which is used by + * Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied. + */ +@Fluent +public final class AdditionalUnattendContent { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdditionalUnattendContent.class); + + /* + * The pass name. Currently, the only allowable value is OobeSystem. + */ + @JsonProperty(value = "passName") + private PassNames passName; + + /* + * The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + */ + @JsonProperty(value = "componentName") + private ComponentNames componentName; + + /* + * Specifies the name of the setting to which the content applies. Possible + * values are: FirstLogonCommands and AutoLogon. + */ + @JsonProperty(value = "settingName") + private SettingNames settingName; + + /* + * Specifies the XML formatted content that is added to the unattend.xml + * file for the specified path and component. The XML must be less than 4KB + * and must include the root element for the setting or feature that is + * being inserted. + */ + @JsonProperty(value = "content") + private String content; + + /** + * Get the passName property: The pass name. Currently, the only allowable value is OobeSystem. + * + * @return the passName value. + */ + public PassNames passName() { + return this.passName; + } + + /** + * Set the passName property: The pass name. Currently, the only allowable value is OobeSystem. + * + * @param passName the passName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withPassName(PassNames passName) { + this.passName = passName; + return this; + } + + /** + * Get the componentName property: The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + * + * @return the componentName value. + */ + public ComponentNames componentName() { + return this.componentName; + } + + /** + * Set the componentName property: The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + * + * @param componentName the componentName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withComponentName(ComponentNames componentName) { + this.componentName = componentName; + return this; + } + + /** + * Get the settingName property: Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + * + * @return the settingName value. + */ + public SettingNames settingName() { + return this.settingName; + } + + /** + * Set the settingName property: Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + * + * @param settingName the settingName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withSettingName(SettingNames settingName) { + this.settingName = settingName; + return this; + } + + /** + * Get the content property: Specifies the XML formatted content that is added to the unattend.xml file for the + * specified path and component. The XML must be less than 4KB and must include the root element for the setting or + * feature that is being inserted. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: Specifies the XML formatted content that is added to the unattend.xml file for the + * specified path and component. The XML must be less than 4KB and must include the root element for the setting or + * feature that is being inserted. + * + * @param content the content value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withContent(String content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AggregatedReplicationState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AggregatedReplicationState.java new file mode 100644 index 0000000000000..28a82a6cd66f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AggregatedReplicationState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AggregatedReplicationState. */ +public final class AggregatedReplicationState extends ExpandableStringEnum { + /** Static value Unknown for AggregatedReplicationState. */ + public static final AggregatedReplicationState UNKNOWN = fromString("Unknown"); + + /** Static value InProgress for AggregatedReplicationState. */ + public static final AggregatedReplicationState IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for AggregatedReplicationState. */ + public static final AggregatedReplicationState COMPLETED = fromString("Completed"); + + /** Static value Failed for AggregatedReplicationState. */ + public static final AggregatedReplicationState FAILED = fromString("Failed"); + + /** + * Creates or finds a AggregatedReplicationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregatedReplicationState. + */ + @JsonCreator + public static AggregatedReplicationState fromString(String name) { + return fromString(name, AggregatedReplicationState.class); + } + + /** @return known AggregatedReplicationState values. */ + public static Collection values() { + return values(AggregatedReplicationState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiEntityReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiEntityReference.java new file mode 100644 index 0000000000000..b0ab4f0d9bcc8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiEntityReference.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The API entity reference. */ +@Fluent +public final class ApiEntityReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiEntityReference.class); + + /* + * The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * + * @param id the id value to set. + * @return the ApiEntityReference object itself. + */ + public ApiEntityReference withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiError.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiError.java new file mode 100644 index 0000000000000..4d7c6f9a558e4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiError.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An error response from the Compute service. */ +@Immutable +public final class ApiError extends ManagementError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiError.class); + + /* + * The Api inner error + */ + @JsonProperty(value = "innererror", access = JsonProperty.Access.WRITE_ONLY) + private InnerError innererror; + + /** + * Get the innererror property: The Api inner error. + * + * @return the innererror value. + */ + public InnerError getInnererror() { + return this.innererror; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (getInnererror() != null) { + getInnererror().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiErrorException.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiErrorException.java new file mode 100644 index 0000000000000..2f9905501fc05 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApiErrorException.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** Exception thrown for an invalid response with ApiError information. */ +public final class ApiErrorException extends ManagementException { + /** + * Initializes a new instance of the ApiErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ApiErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ApiErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ApiErrorException(String message, HttpResponse response, ApiError value) { + super(message, response, value); + } + + @Override + public ApiError getValue() { + return (ApiError) super.getValue(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApplicationProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApplicationProfile.java new file mode 100644 index 0000000000000..a001eb141197f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ApplicationProfile.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains the list of gallery applications that should be made available to the VM/VMSS. */ +@Fluent +public final class ApplicationProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationProfile.class); + + /* + * Specifies the gallery applications that should be made available to the + * VM/VMSS + */ + @JsonProperty(value = "galleryApplications") + private List galleryApplications; + + /** + * Get the galleryApplications property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the galleryApplications value. + */ + public List galleryApplications() { + return this.galleryApplications; + } + + /** + * Set the galleryApplications property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param galleryApplications the galleryApplications value to set. + * @return the ApplicationProfile object itself. + */ + public ApplicationProfile withGalleryApplications(List galleryApplications) { + this.galleryApplications = galleryApplications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (galleryApplications() != null) { + galleryApplications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradePolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradePolicy.java new file mode 100644 index 0000000000000..e871ef45110b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradePolicy.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The configuration parameters used for performing automatic OS upgrade. */ +@Fluent +public final class AutomaticOSUpgradePolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomaticOSUpgradePolicy.class); + + /* + * Indicates whether OS upgrades should automatically be applied to scale + * set instances in a rolling fashion when a newer version of the OS image + * becomes available. Default value is false.

    If this is set to + * true for Windows based scale sets, + * [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + * is automatically set to false and cannot be set to true. + */ + @JsonProperty(value = "enableAutomaticOSUpgrade") + private Boolean enableAutomaticOSUpgrade; + + /* + * Whether OS image rollback feature should be disabled. Default value is + * false. + */ + @JsonProperty(value = "disableAutomaticRollback") + private Boolean disableAutomaticRollback; + + /** + * Get the enableAutomaticOSUpgrade property: Indicates whether OS upgrades should automatically be applied to scale + * set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is + * false. <br><br> If this is set to true for Windows based scale sets, + * [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + * is automatically set to false and cannot be set to true. + * + * @return the enableAutomaticOSUpgrade value. + */ + public Boolean enableAutomaticOSUpgrade() { + return this.enableAutomaticOSUpgrade; + } + + /** + * Set the enableAutomaticOSUpgrade property: Indicates whether OS upgrades should automatically be applied to scale + * set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is + * false. <br><br> If this is set to true for Windows based scale sets, + * [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) + * is automatically set to false and cannot be set to true. + * + * @param enableAutomaticOSUpgrade the enableAutomaticOSUpgrade value to set. + * @return the AutomaticOSUpgradePolicy object itself. + */ + public AutomaticOSUpgradePolicy withEnableAutomaticOSUpgrade(Boolean enableAutomaticOSUpgrade) { + this.enableAutomaticOSUpgrade = enableAutomaticOSUpgrade; + return this; + } + + /** + * Get the disableAutomaticRollback property: Whether OS image rollback feature should be disabled. Default value is + * false. + * + * @return the disableAutomaticRollback value. + */ + public Boolean disableAutomaticRollback() { + return this.disableAutomaticRollback; + } + + /** + * Set the disableAutomaticRollback property: Whether OS image rollback feature should be disabled. Default value is + * false. + * + * @param disableAutomaticRollback the disableAutomaticRollback value to set. + * @return the AutomaticOSUpgradePolicy object itself. + */ + public AutomaticOSUpgradePolicy withDisableAutomaticRollback(Boolean disableAutomaticRollback) { + this.disableAutomaticRollback = disableAutomaticRollback; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradeProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradeProperties.java new file mode 100644 index 0000000000000..e83f30268b9f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticOSUpgradeProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes automatic OS upgrade properties on the image. */ +@Fluent +public final class AutomaticOSUpgradeProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomaticOSUpgradeProperties.class); + + /* + * Specifies whether automatic OS upgrade is supported on the image. + */ + @JsonProperty(value = "automaticOSUpgradeSupported", required = true) + private boolean automaticOSUpgradeSupported; + + /** + * Get the automaticOSUpgradeSupported property: Specifies whether automatic OS upgrade is supported on the image. + * + * @return the automaticOSUpgradeSupported value. + */ + public boolean automaticOSUpgradeSupported() { + return this.automaticOSUpgradeSupported; + } + + /** + * Set the automaticOSUpgradeSupported property: Specifies whether automatic OS upgrade is supported on the image. + * + * @param automaticOSUpgradeSupported the automaticOSUpgradeSupported value to set. + * @return the AutomaticOSUpgradeProperties object itself. + */ + public AutomaticOSUpgradeProperties withAutomaticOSUpgradeSupported(boolean automaticOSUpgradeSupported) { + this.automaticOSUpgradeSupported = automaticOSUpgradeSupported; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticRepairsPolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticRepairsPolicy.java new file mode 100644 index 0000000000000..71b4765efe9b6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AutomaticRepairsPolicy.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the configuration parameters for automatic repairs on the virtual machine scale set. */ +@Fluent +public final class AutomaticRepairsPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomaticRepairsPolicy.class); + + /* + * Specifies whether automatic repairs should be enabled on the virtual + * machine scale set. The default value is false. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * The amount of time for which automatic repairs are suspended due to a + * state change on VM. The grace time starts after the state change has + * completed. This helps avoid premature or accidental repairs. The time + * duration should be specified in ISO 8601 format. The minimum allowed + * grace period is 10 minutes (PT10M), which is also the default value. The + * maximum allowed grace period is 90 minutes (PT90M). + */ + @JsonProperty(value = "gracePeriod") + private String gracePeriod; + + /* + * Type of repair action (replace, restart, reimage) that will be used for + * repairing unhealthy virtual machines in the scale set. Default value is + * replace. + */ + @JsonProperty(value = "repairAction") + private RepairAction repairAction; + + /** + * Get the enabled property: Specifies whether automatic repairs should be enabled on the virtual machine scale set. + * The default value is false. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Specifies whether automatic repairs should be enabled on the virtual machine scale set. + * The default value is false. + * + * @param enabled the enabled value to set. + * @return the AutomaticRepairsPolicy object itself. + */ + public AutomaticRepairsPolicy withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the gracePeriod property: The amount of time for which automatic repairs are suspended due to a state change + * on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental + * repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 10 minutes + * (PT10M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M). + * + * @return the gracePeriod value. + */ + public String gracePeriod() { + return this.gracePeriod; + } + + /** + * Set the gracePeriod property: The amount of time for which automatic repairs are suspended due to a state change + * on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental + * repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 10 minutes + * (PT10M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M). + * + * @param gracePeriod the gracePeriod value to set. + * @return the AutomaticRepairsPolicy object itself. + */ + public AutomaticRepairsPolicy withGracePeriod(String gracePeriod) { + this.gracePeriod = gracePeriod; + return this; + } + + /** + * Get the repairAction property: Type of repair action (replace, restart, reimage) that will be used for repairing + * unhealthy virtual machines in the scale set. Default value is replace. + * + * @return the repairAction value. + */ + public RepairAction repairAction() { + return this.repairAction; + } + + /** + * Set the repairAction property: Type of repair action (replace, restart, reimage) that will be used for repairing + * unhealthy virtual machines in the scale set. Default value is replace. + * + * @param repairAction the repairAction value to set. + * @return the AutomaticRepairsPolicy object itself. + */ + public AutomaticRepairsPolicy withRepairAction(RepairAction repairAction) { + this.repairAction = repairAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySet.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySet.java new file mode 100644 index 0000000000000..c287f7cf3483a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySet.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of AvailabilitySet. */ +public interface AvailabilitySet { + /** + * 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 sku property: Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes + * for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual + * machines with unmanaged disks. Default value is 'Classic'. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the platformUpdateDomainCount property: Update Domain count. + * + * @return the platformUpdateDomainCount value. + */ + Integer platformUpdateDomainCount(); + + /** + * Gets the platformFaultDomainCount property: Fault Domain count. + * + * @return the platformFaultDomainCount value. + */ + Integer platformFaultDomainCount(); + + /** + * Gets the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @return the virtualMachines value. + */ + List virtualMachines(); + + /** + * Gets the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + SubResource proximityPlacementGroup(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner object. + * + * @return the inner object. + */ + AvailabilitySetInner innerModel(); + + /** The entirety of the AvailabilitySet definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The AvailabilitySet definition stages. */ + interface DefinitionStages { + /** The first stage of the AvailabilitySet definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AvailabilitySet 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 AvailabilitySet definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the AvailabilitySet 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.WithSku, + DefinitionStages.WithPlatformUpdateDomainCount, + DefinitionStages.WithPlatformFaultDomainCount, + DefinitionStages.WithVirtualMachines, + DefinitionStages.WithProximityPlacementGroup { + /** + * Executes the create request. + * + * @return the created resource. + */ + AvailabilitySet create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AvailabilitySet create(Context context); + } + /** The stage of the AvailabilitySet 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 AvailabilitySet definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Sku of the availability set, only name is required to be set. See + * AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks + * and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.. + * + * @param sku Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for + * possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for + * virtual machines with unmanaged disks. Default value is 'Classic'. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the AvailabilitySet definition allowing to specify platformUpdateDomainCount. */ + interface WithPlatformUpdateDomainCount { + /** + * Specifies the platformUpdateDomainCount property: Update Domain count.. + * + * @param platformUpdateDomainCount Update Domain count. + * @return the next definition stage. + */ + WithCreate withPlatformUpdateDomainCount(Integer platformUpdateDomainCount); + } + /** The stage of the AvailabilitySet definition allowing to specify platformFaultDomainCount. */ + interface WithPlatformFaultDomainCount { + /** + * Specifies the platformFaultDomainCount property: Fault Domain count.. + * + * @param platformFaultDomainCount Fault Domain count. + * @return the next definition stage. + */ + WithCreate withPlatformFaultDomainCount(Integer platformFaultDomainCount); + } + /** The stage of the AvailabilitySet definition allowing to specify virtualMachines. */ + interface WithVirtualMachines { + /** + * Specifies the virtualMachines property: A list of references to all virtual machines in the availability + * set.. + * + * @param virtualMachines A list of references to all virtual machines in the availability set. + * @return the next definition stage. + */ + WithCreate withVirtualMachines(List virtualMachines); + } + /** The stage of the AvailabilitySet definition allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + WithCreate withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + } + /** + * Begins update for the AvailabilitySet resource. + * + * @return the stage of resource update. + */ + AvailabilitySet.Update update(); + + /** The template for AvailabilitySet update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithPlatformUpdateDomainCount, + UpdateStages.WithPlatformFaultDomainCount, + UpdateStages.WithVirtualMachines, + UpdateStages.WithProximityPlacementGroup { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AvailabilitySet apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AvailabilitySet apply(Context context); + } + /** The AvailabilitySet update stages. */ + interface UpdateStages { + /** The stage of the AvailabilitySet 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 AvailabilitySet update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Sku of the availability set. + * + * @param sku Sku of the availability set. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the AvailabilitySet update allowing to specify platformUpdateDomainCount. */ + interface WithPlatformUpdateDomainCount { + /** + * Specifies the platformUpdateDomainCount property: Update Domain count.. + * + * @param platformUpdateDomainCount Update Domain count. + * @return the next definition stage. + */ + Update withPlatformUpdateDomainCount(Integer platformUpdateDomainCount); + } + /** The stage of the AvailabilitySet update allowing to specify platformFaultDomainCount. */ + interface WithPlatformFaultDomainCount { + /** + * Specifies the platformFaultDomainCount property: Fault Domain count.. + * + * @param platformFaultDomainCount Fault Domain count. + * @return the next definition stage. + */ + Update withPlatformFaultDomainCount(Integer platformFaultDomainCount); + } + /** The stage of the AvailabilitySet update allowing to specify virtualMachines. */ + interface WithVirtualMachines { + /** + * Specifies the virtualMachines property: A list of references to all virtual machines in the availability + * set.. + * + * @param virtualMachines A list of references to all virtual machines in the availability set. + * @return the next definition stage. + */ + Update withVirtualMachines(List virtualMachines); + } + /** The stage of the AvailabilitySet update allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + Update withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AvailabilitySet refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AvailabilitySet refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetListResult.java new file mode 100644 index 0000000000000..80a3a420cfce1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Availability Set operation response. */ +@Fluent +public final class AvailabilitySetListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilitySetListResult.class); + + /* + * The list of availability sets + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of AvailabilitySets. Call ListNext() with + * this URI to fetch the next page of AvailabilitySets. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of availability sets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of availability sets. + * + * @param value the value value to set. + * @return the AvailabilitySetListResult object itself. + */ + public AvailabilitySetListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to + * fetch the next page of AvailabilitySets. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to + * fetch the next page of AvailabilitySets. + * + * @param nextLink the nextLink value to set. + * @return the AvailabilitySetListResult object itself. + */ + public AvailabilitySetListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AvailabilitySetListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetUpdate.java new file mode 100644 index 0000000000000..411ad4991e2cc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySetUpdate.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.AvailabilitySetProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be + * updated. + */ +@Fluent +public final class AvailabilitySetUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilitySetUpdate.class); + + /* + * The instance view of a resource. + */ + @JsonProperty(value = "properties") + private AvailabilitySetProperties innerProperties; + + /* + * Sku of the availability set + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the innerProperties property: The instance view of a resource. + * + * @return the innerProperties value. + */ + private AvailabilitySetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: Sku of the availability set. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Sku of the availability set. + * + * @param sku the sku value to set. + * @return the AvailabilitySetUpdate object itself. + */ + public AvailabilitySetUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public AvailabilitySetUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformUpdateDomainCount property: Update Domain count. + * + * @return the platformUpdateDomainCount value. + */ + public Integer platformUpdateDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformUpdateDomainCount(); + } + + /** + * Set the platformUpdateDomainCount property: Update Domain count. + * + * @param platformUpdateDomainCount the platformUpdateDomainCount value to set. + * @return the AvailabilitySetUpdate object itself. + */ + public AvailabilitySetUpdate withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withPlatformUpdateDomainCount(platformUpdateDomainCount); + return this; + } + + /** + * Get the platformFaultDomainCount property: Fault Domain count. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomainCount(); + } + + /** + * Set the platformFaultDomainCount property: Fault Domain count. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the AvailabilitySetUpdate object itself. + */ + public AvailabilitySetUpdate withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachines(); + } + + /** + * Set the virtualMachines property: A list of references to all virtual machines in the availability set. + * + * @param virtualMachines the virtualMachines value to set. + * @return the AvailabilitySetUpdate object itself. + */ + public AvailabilitySetUpdate withVirtualMachines(List virtualMachines) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withVirtualMachines(virtualMachines); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the AvailabilitySetUpdate object itself. + */ + public AvailabilitySetUpdate withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySets.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySets.java new file mode 100644 index 0000000000000..49e555a4f870e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailabilitySets.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 AvailabilitySets. */ +public interface AvailabilitySets { + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 availabilitySetName); + + /** + * Delete an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteWithResponse(String resourceGroupName, String availabilitySetName, Context context); + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to. + */ + AvailabilitySet getByResourceGroup(String resourceGroupName, String availabilitySetName); + + /** + * Retrieves information about an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context); + + /** + * Lists all availability sets in a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + PagedIterable list(); + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + PagedIterable list(String expand, Context context); + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all availability sets in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Availability Set operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listAvailableSizes(String resourceGroupName, String availabilitySetName); + + /** + * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing + * availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listAvailableSizes( + String resourceGroupName, String availabilitySetName, Context context); + + /** + * Retrieves information about an availability set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + AvailabilitySet getById(String id); + + /** + * Retrieves information about an availability set. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the availability set that the virtual machine should be assigned to along + * with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an availability set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an availability set. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AvailabilitySet resource. + * + * @param name resource name. + * @return the first stage of the new AvailabilitySet definition. + */ + AvailabilitySet.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailablePatchSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailablePatchSummary.java new file mode 100644 index 0000000000000..c3d158e90ea6c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/AvailablePatchSummary.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of an virtual machine instance view for available patch summary. */ +@Immutable +public final class AvailablePatchSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailablePatchSummary.class); + + /* + * The overall success or failure status of the operation. It remains + * "InProgress" until the operation completes. At that point it will become + * "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings." + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private PatchOperationStatus status; + + /* + * The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + */ + @JsonProperty(value = "assessmentActivityId", access = JsonProperty.Access.WRITE_ONLY) + private String assessmentActivityId; + + /* + * The overall reboot status of the VM. It will be true when partially + * installed patches require a reboot to complete installation but the + * reboot has not yet occurred. + */ + @JsonProperty(value = "rebootPending", access = JsonProperty.Access.WRITE_ONLY) + private Boolean rebootPending; + + /* + * The number of critical or security patches that have been detected as + * available and not yet installed. + */ + @JsonProperty(value = "criticalAndSecurityPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer criticalAndSecurityPatchCount; + + /* + * The number of all available patches excluding critical and security. + */ + @JsonProperty(value = "otherPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer otherPatchCount; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * The errors that were encountered during execution of the operation. The + * details array contains the list of them. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Get the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + public PatchOperationStatus status() { + return this.status; + } + + /** + * Get the assessmentActivityId property: The activity ID of the operation that produced this result. It is used to + * correlate across CRP and extension logs. + * + * @return the assessmentActivityId value. + */ + public String assessmentActivityId() { + return this.assessmentActivityId; + } + + /** + * Get the rebootPending property: The overall reboot status of the VM. It will be true when partially installed + * patches require a reboot to complete installation but the reboot has not yet occurred. + * + * @return the rebootPending value. + */ + public Boolean rebootPending() { + return this.rebootPending; + } + + /** + * Get the criticalAndSecurityPatchCount property: The number of critical or security patches that have been + * detected as available and not yet installed. + * + * @return the criticalAndSecurityPatchCount value. + */ + public Integer criticalAndSecurityPatchCount() { + return this.criticalAndSecurityPatchCount; + } + + /** + * Get the otherPatchCount property: The number of all available patches excluding critical and security. + * + * @return the otherPatchCount value. + */ + public Integer otherPatchCount() { + return this.otherPatchCount; + } + + /** + * Get the startTime property: The UTC timestamp when the operation began. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the lastModifiedTime property: The UTC timestamp when the operation began. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BillingProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BillingProfile.java new file mode 100644 index 0000000000000..df0927e3b349e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BillingProfile.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the billing related details of a Azure Spot VM or VMSS. <br><br>Minimum api-version: + * 2019-03-01. + */ +@Fluent +public final class BillingProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfile.class); + + /* + * Specifies the maximum price you are willing to pay for a Azure Spot + * VM/VMSS. This price is in US Dollars.

    This price will be + * compared with the current Azure Spot price for the VM size. Also, the + * prices are compared at the time of create/update of Azure Spot VM/VMSS + * and the operation will only succeed if the maxPrice is greater than the + * current Azure Spot price.

    The maxPrice will also be used for + * evicting a Azure Spot VM/VMSS if the current Azure Spot price goes + * beyond the maxPrice after creation of VM/VMSS.

    Possible values + * are:

    - Any decimal value greater than zero. Example: 0.01538 + *

    -1 – indicates default price to be up-to on-demand.

    + * You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS + * should not be evicted for price reasons. Also, the default max price is + * -1 if it is not provided by you.

    Minimum api-version: + * 2019-03-01. + */ + @JsonProperty(value = "maxPrice") + private Double maxPrice; + + /** + * Get the maxPrice property: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This + * price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for + * the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation + * will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice + * will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + * after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value + * greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand. + * <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted + * for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the maxPrice value. + */ + public Double maxPrice() { + return this.maxPrice; + } + + /** + * Set the maxPrice property: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This + * price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for + * the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation + * will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice + * will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + * after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value + * greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand. + * <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted + * for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum + * api-version: 2019-03-01. + * + * @param maxPrice the maxPrice value to set. + * @return the BillingProfile object itself. + */ + public BillingProfile withMaxPrice(Double maxPrice) { + this.maxPrice = maxPrice; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnostics.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnostics.java new file mode 100644 index 0000000000000..3c39ddeaf0e7b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnostics.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. + * <br><br> You can easily view the output of your console log. <br><br> Azure also enables you + * to see a screenshot of the VM from the hypervisor. + */ +@Fluent +public final class BootDiagnostics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BootDiagnostics.class); + + /* + * Whether boot diagnostics should be enabled on the Virtual Machine. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * Uri of the storage account to use for placing the console output and + * screenshot.

    If storageUri is not specified while enabling boot + * diagnostics, managed storage will be used. + */ + @JsonProperty(value = "storageUri") + private String storageUri; + + /** + * Get the enabled property: Whether boot diagnostics should be enabled on the Virtual Machine. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Whether boot diagnostics should be enabled on the Virtual Machine. + * + * @param enabled the enabled value to set. + * @return the BootDiagnostics object itself. + */ + public BootDiagnostics withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the storageUri property: Uri of the storage account to use for placing the console output and screenshot. + * <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Uri of the storage account to use for placing the console output and screenshot. + * <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + * + * @param storageUri the storageUri value to set. + * @return the BootDiagnostics object itself. + */ + public BootDiagnostics withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnosticsInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnosticsInstanceView.java new file mode 100644 index 0000000000000..727504951eca4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/BootDiagnosticsInstanceView.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The instance view of a virtual machine boot diagnostics. */ +@Immutable +public final class BootDiagnosticsInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BootDiagnosticsInstanceView.class); + + /* + * The console screenshot blob URI.

    NOTE: This will **not** be set + * if boot diagnostics is currently enabled with managed storage. + */ + @JsonProperty(value = "consoleScreenshotBlobUri", access = JsonProperty.Access.WRITE_ONLY) + private String consoleScreenshotBlobUri; + + /* + * The serial console log blob Uri.

    NOTE: This will **not** be set + * if boot diagnostics is currently enabled with managed storage. + */ + @JsonProperty(value = "serialConsoleLogBlobUri", access = JsonProperty.Access.WRITE_ONLY) + private String serialConsoleLogBlobUri; + + /* + * The boot diagnostics status information for the VM.

    NOTE: It + * will be set only if there are errors encountered in enabling boot + * diagnostics. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private InstanceViewStatus status; + + /** + * Get the consoleScreenshotBlobUri property: The console screenshot blob URI. <br><br>NOTE: This will + * **not** be set if boot diagnostics is currently enabled with managed storage. + * + * @return the consoleScreenshotBlobUri value. + */ + public String consoleScreenshotBlobUri() { + return this.consoleScreenshotBlobUri; + } + + /** + * Get the serialConsoleLogBlobUri property: The serial console log blob Uri. <br><br>NOTE: This will + * **not** be set if boot diagnostics is currently enabled with managed storage. + * + * @return the serialConsoleLogBlobUri value. + */ + public String serialConsoleLogBlobUri() { + return this.serialConsoleLogBlobUri; + } + + /** + * Get the status property: The boot diagnostics status information for the VM. <br><br> NOTE: It will + * be set only if there are errors encountered in enabling boot diagnostics. + * + * @return the status value. + */ + public InstanceViewStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CachingTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CachingTypes.java new file mode 100644 index 0000000000000..04a6980073f1d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CachingTypes.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CachingTypes. */ +public enum CachingTypes { + /** Enum value None. */ + NONE("None"), + + /** Enum value ReadOnly. */ + READ_ONLY("ReadOnly"), + + /** Enum value ReadWrite. */ + READ_WRITE("ReadWrite"); + + /** The actual serialized value for a CachingTypes instance. */ + private final String value; + + CachingTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CachingTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed CachingTypes object, or null if unable to parse. + */ + @JsonCreator + public static CachingTypes fromString(String value) { + CachingTypes[] items = CachingTypes.values(); + for (CachingTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservation.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservation.java new file mode 100644 index 0000000000000..add9ea9ba5afb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservation.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CapacityReservation. */ +public interface CapacityReservation { + /** + * 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 sku property: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the zones property: Availability Zone to use for this capacity reservation. The zone has to be single value + * and also should be part for the list of zones specified during the capacity reservation group creation. The zone + * can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If + * provided, enforces VM/VMSS using this capacity reservation to be in same zone. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the reservationId property: A unique id generated and assigned to the capacity reservation by the platform + * which does not change throughout the lifetime of the resource. + * + * @return the reservationId value. + */ + String reservationId(); + + /** + * Gets the virtualMachinesAssociated property: A list of all virtual machine resource ids that are associated with + * the capacity reservation. + * + * @return the virtualMachinesAssociated value. + */ + List virtualMachinesAssociated(); + + /** + * Gets the provisioningTime property: The date time when the capacity reservation was last updated. + * + * @return the provisioningTime value. + */ + OffsetDateTime provisioningTime(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The Capacity reservation instance view. + * + * @return the instanceView value. + */ + CapacityReservationInstanceView instanceView(); + + /** + * Gets the timeCreated property: Specifies the time at which the Capacity Reservation resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner object. + * + * @return the inner object. + */ + CapacityReservationInner innerModel(); + + /** The entirety of the CapacityReservation definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The CapacityReservation definition stages. */ + interface DefinitionStages { + /** The first stage of the CapacityReservation definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CapacityReservation definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the CapacityReservation definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, capacityReservationGroupName. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @return the next definition stage. + */ + WithSku withExistingCapacityReservationGroup(String resourceGroupName, String capacityReservationGroupName); + } + /** The stage of the CapacityReservation definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and + * capacity is required to be set. Currently VM Skus with the capability called + * 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a + * region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values.. + * + * @param sku SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set + * to true are supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** + * The stage of the CapacityReservation 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.WithZones { + /** + * Executes the create request. + * + * @return the created resource. + */ + CapacityReservation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CapacityReservation create(Context context); + } + /** The stage of the CapacityReservation 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 CapacityReservation definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: Availability Zone to use for this capacity reservation. The zone has to be + * single value and also should be part for the list of zones specified during the capacity reservation + * group creation. The zone can be assigned only during creation. If not provided, the reservation supports + * only non-zonal deployments. If provided, enforces VM/VMSS using this capacity reservation to be in same + * zone.. + * + * @param zones Availability Zone to use for this capacity reservation. The zone has to be single value and + * also should be part for the list of zones specified during the capacity reservation group creation. + * The zone can be assigned only during creation. If not provided, the reservation supports only + * non-zonal deployments. If provided, enforces VM/VMSS using this capacity reservation to be in same + * zone. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + } + /** + * Begins update for the CapacityReservation resource. + * + * @return the stage of resource update. + */ + CapacityReservation.Update update(); + + /** The template for CapacityReservation update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CapacityReservation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CapacityReservation apply(Context context); + } + /** The CapacityReservation update stages. */ + interface UpdateStages { + /** The stage of the CapacityReservation 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 CapacityReservation update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and + * capacity is required to be set. Currently VM Skus with the capability called + * 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a + * region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values.. + * + * @param sku SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set + * to true are supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CapacityReservation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CapacityReservation refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroup.java new file mode 100644 index 0000000000000..25bd307e503b3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroup.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CapacityReservationGroup. */ +public interface CapacityReservationGroup { + /** + * 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 zones property: Availability Zones to use for this capacity reservation group. The zones can be assigned + * only during creation. If not provided, the group supports only regional resources in the region. If provided, + * enforces each capacity reservation in the group to be in one of the zones. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the capacityReservations property: A list of all capacity reservation resource ids that belong to capacity + * reservation group. + * + * @return the capacityReservations value. + */ + List capacityReservations(); + + /** + * Gets the virtualMachinesAssociated property: A list of references to all virtual machines associated to the + * capacity reservation group. + * + * @return the virtualMachinesAssociated value. + */ + List virtualMachinesAssociated(); + + /** + * Gets the instanceView property: The capacity reservation group instance view which has the list of instance views + * for all the capacity reservations that belong to the capacity reservation group. + * + * @return the instanceView value. + */ + CapacityReservationGroupInstanceView instanceView(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner object. + * + * @return the inner object. + */ + CapacityReservationGroupInner innerModel(); + + /** The entirety of the CapacityReservationGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CapacityReservationGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the CapacityReservationGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CapacityReservationGroup 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 CapacityReservationGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CapacityReservationGroup 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.WithZones { + /** + * Executes the create request. + * + * @return the created resource. + */ + CapacityReservationGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CapacityReservationGroup create(Context context); + } + /** The stage of the CapacityReservationGroup 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 CapacityReservationGroup definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: Availability Zones to use for this capacity reservation group. The zones + * can be assigned only during creation. If not provided, the group supports only regional resources in the + * region. If provided, enforces each capacity reservation in the group to be in one of the zones.. + * + * @param zones Availability Zones to use for this capacity reservation group. The zones can be assigned + * only during creation. If not provided, the group supports only regional resources in the region. If + * provided, enforces each capacity reservation in the group to be in one of the zones. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + } + /** + * Begins update for the CapacityReservationGroup resource. + * + * @return the stage of resource update. + */ + CapacityReservationGroup.Update update(); + + /** The template for CapacityReservationGroup update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CapacityReservationGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CapacityReservationGroup apply(Context context); + } + /** The CapacityReservationGroup update stages. */ + interface UpdateStages { + /** The stage of the CapacityReservationGroup 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. + */ + CapacityReservationGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CapacityReservationGroup refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceView.java new file mode 100644 index 0000000000000..ace89bc8f19f1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceView.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CapacityReservationGroupInstanceView model. */ +@Immutable +public final class CapacityReservationGroupInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupInstanceView.class); + + /* + * List of instance view of the capacity reservations under the capacity + * reservation group. + */ + @JsonProperty(value = "capacityReservations", access = JsonProperty.Access.WRITE_ONLY) + private List capacityReservations; + + /** + * Get the capacityReservations property: List of instance view of the capacity reservations under the capacity + * reservation group. + * + * @return the capacityReservations value. + */ + public List capacityReservations() { + return this.capacityReservations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capacityReservations() != null) { + capacityReservations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceViewTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceViewTypes.java new file mode 100644 index 0000000000000..7dea4bbe6ebf7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupInstanceViewTypes.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CapacityReservationGroupInstanceViewTypes. */ +public final class CapacityReservationGroupInstanceViewTypes + extends ExpandableStringEnum { + /** Static value instanceView for CapacityReservationGroupInstanceViewTypes. */ + public static final CapacityReservationGroupInstanceViewTypes INSTANCE_VIEW = fromString("instanceView"); + + /** + * Creates or finds a CapacityReservationGroupInstanceViewTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding CapacityReservationGroupInstanceViewTypes. + */ + @JsonCreator + public static CapacityReservationGroupInstanceViewTypes fromString(String name) { + return fromString(name, CapacityReservationGroupInstanceViewTypes.class); + } + + /** @return known CapacityReservationGroupInstanceViewTypes values. */ + public static Collection values() { + return values(CapacityReservationGroupInstanceViewTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupListResult.java new file mode 100644 index 0000000000000..25bca7bf9784d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupListResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List capacity reservation group with resource group response. */ +@Fluent +public final class CapacityReservationGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupListResult.class); + + /* + * The list of capacity reservation groups + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of capacity reservation groups. Call + * ListNext() with this URI to fetch the next page of capacity reservation + * groups. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of capacity reservation groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of capacity reservation groups. + * + * @param value the value value to set. + * @return the CapacityReservationGroupListResult object itself. + */ + public CapacityReservationGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of capacity reservation groups. Call ListNext() with + * this URI to fetch the next page of capacity reservation groups. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of capacity reservation groups. Call ListNext() with + * this URI to fetch the next page of capacity reservation groups. + * + * @param nextLink the nextLink value to set. + * @return the CapacityReservationGroupListResult object itself. + */ + public CapacityReservationGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model CapacityReservationGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupUpdate.java new file mode 100644 index 0000000000000..5d03ce2a74604 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroupUpdate.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationGroupProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Specifies information about the capacity reservation group. Only tags can be updated. */ +@Fluent +public final class CapacityReservationGroupUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationGroupUpdate.class); + + /* + * capacity reservation group Properties. + */ + @JsonProperty(value = "properties") + private CapacityReservationGroupProperties innerProperties; + + /** + * Get the innerProperties property: capacity reservation group Properties. + * + * @return the innerProperties value. + */ + private CapacityReservationGroupProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationGroupUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the capacityReservations property: A list of all capacity reservation resource ids that belong to capacity + * reservation group. + * + * @return the capacityReservations value. + */ + public List capacityReservations() { + return this.innerProperties() == null ? null : this.innerProperties().capacityReservations(); + } + + /** + * Get the virtualMachinesAssociated property: A list of references to all virtual machines associated to the + * capacity reservation group. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachinesAssociated(); + } + + /** + * Get the instanceView property: The capacity reservation group instance view which has the list of instance views + * for all the capacity reservations that belong to the capacity reservation group. + * + * @return the instanceView value. + */ + public CapacityReservationGroupInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroups.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroups.java new file mode 100644 index 0000000000000..a2c9c4eca8a95 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationGroups.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 CapacityReservationGroups. */ +public interface CapacityReservationGroups { + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName); + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteWithResponse(String resourceGroupName, String capacityReservationGroupName, Context context); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to. + */ + CapacityReservationGroup getByResourceGroup(String resourceGroupName, String capacityReservationGroupName); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + CapacityReservationGroupInstanceViewTypes expand, + Context context); + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the + * response to get the next page of capacity reservation groups. + * + * @param resourceGroupName The name of the resource group. + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, ExpandTypesForGetCapacityReservationGroups expand, Context context); + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + PagedIterable list(); + + /** + * Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to + * get the next page of capacity reservation groups. + * + * @param expand The expand expression to apply on the operation. Based on the expand param(s) specified we return + * Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation + * group in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List capacity reservation group with resource group response. + */ + PagedIterable list(ExpandTypesForGetCapacityReservationGroups expand, Context context); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + CapacityReservationGroup getById(String id); + + /** + * The operation that retrieves information about a capacity reservation group. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime + * properties of a capacity reservation that is managed by the platform and can change outside of control plane + * operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation group that the capacity reservations should be + * assigned to along with {@link Response}. + */ + Response getByIdWithResponse( + String id, CapacityReservationGroupInstanceViewTypes expand, Context context); + + /** + * The operation to delete a capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacity reservation group. This operation is allowed only if all the associated + * resources are disassociated from the reservation group and all capacity reservations under the reservation group + * have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CapacityReservationGroup resource. + * + * @param name resource name. + * @return the first stage of the new CapacityReservationGroup definition. + */ + CapacityReservationGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceView.java new file mode 100644 index 0000000000000..5db7fa2e35bb0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceView.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity + * reservation that is managed by the platform and can change outside of control plane operations. + */ +@Fluent +public class CapacityReservationInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationInstanceView.class); + + /* + * Unutilized capacity of the capacity reservation. + */ + @JsonProperty(value = "utilizationInfo") + private CapacityReservationUtilization utilizationInfo; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the utilizationInfo property: Unutilized capacity of the capacity reservation. + * + * @return the utilizationInfo value. + */ + public CapacityReservationUtilization utilizationInfo() { + return this.utilizationInfo; + } + + /** + * Set the utilizationInfo property: Unutilized capacity of the capacity reservation. + * + * @param utilizationInfo the utilizationInfo value to set. + * @return the CapacityReservationInstanceView object itself. + */ + public CapacityReservationInstanceView withUtilizationInfo(CapacityReservationUtilization utilizationInfo) { + this.utilizationInfo = utilizationInfo; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the CapacityReservationInstanceView object itself. + */ + public CapacityReservationInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (utilizationInfo() != null) { + utilizationInfo().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewTypes.java new file mode 100644 index 0000000000000..a66883e33a051 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewTypes.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CapacityReservationInstanceViewTypes. */ +public final class CapacityReservationInstanceViewTypes + extends ExpandableStringEnum { + /** Static value instanceView for CapacityReservationInstanceViewTypes. */ + public static final CapacityReservationInstanceViewTypes INSTANCE_VIEW = fromString("instanceView"); + + /** + * Creates or finds a CapacityReservationInstanceViewTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding CapacityReservationInstanceViewTypes. + */ + @JsonCreator + public static CapacityReservationInstanceViewTypes fromString(String name) { + return fromString(name, CapacityReservationInstanceViewTypes.class); + } + + /** @return known CapacityReservationInstanceViewTypes values. */ + public static Collection values() { + return values(CapacityReservationInstanceViewTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewWithName.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewWithName.java new file mode 100644 index 0000000000000..836c5f402a113 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationInstanceViewWithName.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the + * response to the instance view of a capacity reservation group. + */ +@Fluent +public final class CapacityReservationInstanceViewWithName extends CapacityReservationInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationInstanceViewWithName.class); + + /* + * The name of the capacity reservation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the name property: The name of the capacity reservation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationInstanceViewWithName withUtilizationInfo(CapacityReservationUtilization utilizationInfo) { + super.withUtilizationInfo(utilizationInfo); + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationInstanceViewWithName withStatuses(List statuses) { + super.withStatuses(statuses); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationListResult.java new file mode 100644 index 0000000000000..b1b4b2a49e06b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list capacity reservation operation response. */ +@Fluent +public final class CapacityReservationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationListResult.class); + + /* + * The list of capacity reservations + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of capacity reservations. Call ListNext() + * with this URI to fetch the next page of capacity reservations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of capacity reservations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of capacity reservations. + * + * @param value the value value to set. + * @return the CapacityReservationListResult object itself. + */ + public CapacityReservationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of capacity reservations. Call ListNext() with this URI + * to fetch the next page of capacity reservations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of capacity reservations. Call ListNext() with this URI + * to fetch the next page of capacity reservations. + * + * @param nextLink the nextLink value to set. + * @return the CapacityReservationListResult object itself. + */ + public CapacityReservationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model CapacityReservationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationProfile.java new file mode 100644 index 0000000000000..32768883d30a8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationProfile.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters of a capacity reservation Profile. */ +@Fluent +public final class CapacityReservationProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationProfile.class); + + /* + * Specifies the capacity reservation group resource id that should be used + * for allocating the virtual machine or scaleset vm instances provided + * enough capacity has been reserved. Please refer to + * https://aka.ms/CapacityReservation for more details. + */ + @JsonProperty(value = "capacityReservationGroup") + private SubResource capacityReservationGroup; + + /** + * Get the capacityReservationGroup property: Specifies the capacity reservation group resource id that should be + * used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. + * Please refer to https://aka.ms/CapacityReservation for more details. + * + * @return the capacityReservationGroup value. + */ + public SubResource capacityReservationGroup() { + return this.capacityReservationGroup; + } + + /** + * Set the capacityReservationGroup property: Specifies the capacity reservation group resource id that should be + * used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. + * Please refer to https://aka.ms/CapacityReservation for more details. + * + * @param capacityReservationGroup the capacityReservationGroup value to set. + * @return the CapacityReservationProfile object itself. + */ + public CapacityReservationProfile withCapacityReservationGroup(SubResource capacityReservationGroup) { + this.capacityReservationGroup = capacityReservationGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUpdate.java new file mode 100644 index 0000000000000..7f0ca83827be7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUpdate.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CapacityReservationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the capacity reservation. Only tags and sku.capacity can be updated. */ +@Fluent +public final class CapacityReservationUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationUpdate.class); + + /* + * Properties of the Capacity reservation. + */ + @JsonProperty(value = "properties") + private CapacityReservationProperties innerProperties; + + /* + * SKU of the resource for which capacity needs be reserved. The SKU name + * and capacity is required to be set. Currently VM Skus with the + * capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for + * supported values. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the innerProperties property: Properties of the Capacity reservation. + * + * @return the innerProperties value. + */ + private CapacityReservationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is + * required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are + * supported. Refer to List Microsoft.Compute SKUs in a region + * (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + * + * @param sku the sku value to set. + * @return the CapacityReservationUpdate object itself. + */ + public CapacityReservationUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public CapacityReservationUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the reservationId property: A unique id generated and assigned to the capacity reservation by the platform + * which does not change throughout the lifetime of the resource. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.innerProperties() == null ? null : this.innerProperties().reservationId(); + } + + /** + * Get the virtualMachinesAssociated property: A list of all virtual machine resource ids that are associated with + * the capacity reservation. + * + * @return the virtualMachinesAssociated value. + */ + public List virtualMachinesAssociated() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachinesAssociated(); + } + + /** + * Get the provisioningTime property: The date time when the capacity reservation was last updated. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningTime(); + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The Capacity reservation instance view. + * + * @return the instanceView value. + */ + public CapacityReservationInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the timeCreated property: Specifies the time at which the Capacity Reservation resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUtilization.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUtilization.java new file mode 100644 index 0000000000000..d7a35633226b3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservationUtilization.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the capacity reservation utilization in terms of resources allocated. */ +@Immutable +public final class CapacityReservationUtilization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapacityReservationUtilization.class); + + /* + * A list of all virtual machines resource ids allocated against the + * capacity reservation. + */ + @JsonProperty(value = "virtualMachinesAllocated", access = JsonProperty.Access.WRITE_ONLY) + private List virtualMachinesAllocated; + + /** + * Get the virtualMachinesAllocated property: A list of all virtual machines resource ids allocated against the + * capacity reservation. + * + * @return the virtualMachinesAllocated value. + */ + public List virtualMachinesAllocated() { + return this.virtualMachinesAllocated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachinesAllocated() != null) { + virtualMachinesAllocated().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservations.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservations.java new file mode 100644 index 0000000000000..bc966c72a170b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CapacityReservations.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 CapacityReservations. */ +public interface CapacityReservations { + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName, String capacityReservationName); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacityReservationGroupName, String capacityReservationName, Context context); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation. + */ + CapacityReservation get( + String resourceGroupName, String capacityReservationGroupName, String capacityReservationName); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param capacityReservationName The name of the capacity reservation. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String capacityReservationGroupName, + String capacityReservationName, + CapacityReservationInstanceViewTypes expand, + Context context); + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName); + + /** + * Lists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in + * the response to get the next page of capacity reservations. + * + * @param resourceGroupName The name of the resource group. + * @param capacityReservationGroupName The name of the capacity reservation group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list capacity reservation operation response. + */ + PagedIterable listByCapacityReservationGroup( + String resourceGroupName, String capacityReservationGroupName, Context context); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response}. + */ + CapacityReservation getById(String id); + + /** + * The operation that retrieves information about the capacity reservation. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the capacity reservation that is managed by the platform and can change outside of control + * plane operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the capacity reservation along with {@link Response}. + */ + Response getByIdWithResponse( + String id, CapacityReservationInstanceViewTypes expand, Context context); + + /** + * The operation to delete a capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 capacity reservation. This operation is allowed only when all the associated resources + * are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation for more + * details. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 CapacityReservation resource. + * + * @param name resource name. + * @return the first stage of the new CapacityReservation definition. + */ + CapacityReservation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudService.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudService.java new file mode 100644 index 0000000000000..dfe42d7e9d8ef --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudService.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner; +import java.util.Map; + +/** An immutable client-side representation of CloudService. */ +public interface CloudService { + /** + * 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: Cloud service properties. + * + * @return the properties value. + */ + CloudServiceProperties properties(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner object. + * + * @return the inner object. + */ + CloudServiceInner innerModel(); + + /** The entirety of the CloudService definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CloudService definition stages. */ + interface DefinitionStages { + /** The first stage of the CloudService definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CloudService 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 CloudService definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CloudService definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CloudService create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CloudService create(Context context); + } + /** The stage of the CloudService 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 CloudService definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Cloud service properties. + * + * @param properties Cloud service properties. + * @return the next definition stage. + */ + WithCreate withProperties(CloudServiceProperties properties); + } + } + /** + * Begins update for the CloudService resource. + * + * @return the stage of resource update. + */ + CloudService.Update update(); + + /** The template for CloudService update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CloudService apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CloudService apply(Context context); + } + /** The CloudService update stages. */ + interface UpdateStages { + /** The stage of the CloudService 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. + */ + CloudService refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CloudService refresh(Context context); + + /** + * Starts the cloud service. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Starts the cloud service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(Context context); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(RoleInstances parameters); + + /** + * Restarts one or more role instances in a cloud service. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(RoleInstances parameters, Context context); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(RoleInstances parameters); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(RoleInstances parameters, Context context); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(RoleInstances parameters); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(RoleInstances parameters, Context context); + + /** + * Deletes role instances in a cloud service. + * + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(RoleInstances parameters); + + /** + * Deletes role instances in a cloud service. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(); + + /** + * Deletes role instances in a cloud service. + * + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(RoleInstances parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProfile.java new file mode 100644 index 0000000000000..623145c3c1543 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProfile.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a cloud service extension profile. */ +@Fluent +public final class CloudServiceExtensionProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceExtensionProfile.class); + + /* + * List of extensions for the cloud service. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /** + * Get the extensions property: List of extensions for the cloud service. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: List of extensions for the cloud service. + * + * @param extensions the extensions value to set. + * @return the CloudServiceExtensionProfile object itself. + */ + public CloudServiceExtensionProfile withExtensions(List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProperties.java new file mode 100644 index 0000000000000..71bce6f8266c4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceExtensionProperties.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Extension Properties. */ +@Fluent +public final class CloudServiceExtensionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceExtensionProperties.class); + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension. + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the extension. Specifies the version of the + * extension. If this element is not specified or an asterisk (*) is used + * as the value, the latest version of the extension is used. If the value + * is specified with a major version number and an asterisk as the minor + * version number (X.), the latest minor version of the specified major + * version is selected. If a major version number and a minor version + * number are specified (X.Y), the specific extension version is selected. + * If a version is specified, an auto-upgrade is performed on the role + * instance. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Explicitly specify whether platform can automatically upgrade + * typeHandlerVersion to higher minor versions when they become available. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Public settings for the extension. For JSON extensions, this is the JSON + * settings for the extension. For XML Extension (like RDP), this is the + * XML setting for the extension. + */ + @JsonProperty(value = "settings") + private String settings; + + /* + * Protected settings for the extension which are encrypted before sent to + * the role instance. + */ + @JsonProperty(value = "protectedSettings") + private String protectedSettings; + + /* + * The protectedSettingsFromKeyVault property. + */ + @JsonProperty(value = "protectedSettingsFromKeyVault") + private CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault; + + /* + * Tag to force apply the provided public and protected settings. + * Changing the tag value allows for re-running the extension without + * changing any of the public or protected settings. + * If forceUpdateTag is not changed, updates to public or protected + * settings would still be applied by the handler. + * If neither forceUpdateTag nor any of public or protected settings + * change, extension would flow to the role instance with the same + * sequence-number, and + * it is up to handler implementation whether to re-run it or not + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Optional list of roles to apply this extension. If property is not + * specified or '*' is specified, extension is applied to all roles in the + * cloud service. + */ + @JsonProperty(value = "rolesAppliedTo") + private List rolesAppliedTo; + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension. + * + * @param type the type value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the extension. Specifies the version of the + * extension. If this element is not specified or an asterisk (*) is used as the value, the latest version of the + * extension is used. If the value is specified with a major version number and an asterisk as the minor version + * number (X.), the latest minor version of the specified major version is selected. If a major version number and a + * minor version number are specified (X.Y), the specific extension version is selected. If a version is specified, + * an auto-upgrade is performed on the role instance. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the extension. Specifies the version of the + * extension. If this element is not specified or an asterisk (*) is used as the value, the latest version of the + * extension is used. If the value is specified with a major version number and an asterisk as the minor version + * number (X.), the latest minor version of the specified major version is selected. If a major version number and a + * minor version number are specified (X.Y), the specific extension version is selected. If a version is specified, + * an auto-upgrade is performed on the role instance. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Explicitly specify whether platform can automatically upgrade + * typeHandlerVersion to higher minor versions when they become available. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Explicitly specify whether platform can automatically upgrade + * typeHandlerVersion to higher minor versions when they become available. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Public settings for the extension. For JSON extensions, this is the JSON settings for + * the extension. For XML Extension (like RDP), this is the XML setting for the extension. + * + * @return the settings value. + */ + public String settings() { + return this.settings; + } + + /** + * Set the settings property: Public settings for the extension. For JSON extensions, this is the JSON settings for + * the extension. For XML Extension (like RDP), this is the XML setting for the extension. + * + * @param settings the settings value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withSettings(String settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: Protected settings for the extension which are encrypted before sent to the + * role instance. + * + * @return the protectedSettings value. + */ + public String protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: Protected settings for the extension which are encrypted before sent to the + * role instance. + * + * @param protectedSettings the protectedSettings value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withProtectedSettings(String protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The protectedSettingsFromKeyVault property. + * + * @return the protectedSettingsFromKeyVault value. + */ + public CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault() { + return this.protectedSettingsFromKeyVault; + } + + /** + * Set the protectedSettingsFromKeyVault property: The protectedSettingsFromKeyVault property. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withProtectedSettingsFromKeyVault( + CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault) { + this.protectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + return this; + } + + /** + * Get the forceUpdateTag property: Tag to force apply the provided public and protected settings. Changing the tag + * value allows for re-running the extension without changing any of the public or protected settings. If + * forceUpdateTag is not changed, updates to public or protected settings would still be applied by the handler. If + * neither forceUpdateTag nor any of public or protected settings change, extension would flow to the role instance + * with the same sequence-number, and it is up to handler implementation whether to re-run it or not. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: Tag to force apply the provided public and protected settings. Changing the tag + * value allows for re-running the extension without changing any of the public or protected settings. If + * forceUpdateTag is not changed, updates to public or protected settings would still be applied by the handler. If + * neither forceUpdateTag nor any of public or protected settings change, extension would flow to the role instance + * with the same sequence-number, and it is up to handler implementation whether to re-run it or not. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the rolesAppliedTo property: Optional list of roles to apply this extension. If property is not specified or + * '*' is specified, extension is applied to all roles in the cloud service. + * + * @return the rolesAppliedTo value. + */ + public List rolesAppliedTo() { + return this.rolesAppliedTo; + } + + /** + * Set the rolesAppliedTo property: Optional list of roles to apply this extension. If property is not specified or + * '*' is specified, extension is applied to all roles in the cloud service. + * + * @param rolesAppliedTo the rolesAppliedTo value to set. + * @return the CloudServiceExtensionProperties object itself. + */ + public CloudServiceExtensionProperties withRolesAppliedTo(List rolesAppliedTo) { + this.rolesAppliedTo = rolesAppliedTo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (protectedSettingsFromKeyVault() != null) { + protectedSettingsFromKeyVault().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceInstanceView.java new file mode 100644 index 0000000000000..0eb16bb0a7b33 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceInstanceView.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner; +import java.util.List; + +/** An immutable client-side representation of CloudServiceInstanceView. */ +public interface CloudServiceInstanceView { + /** + * Gets the roleInstance property: Instance view statuses. + * + * @return the roleInstance value. + */ + InstanceViewStatusesSummary roleInstance(); + + /** + * Gets the sdkVersion property: The version of the SDK that was used to generate the package for the cloud service. + * + * @return the sdkVersion value. + */ + String sdkVersion(); + + /** + * Gets the privateIds property: Specifies a list of unique identifiers generated internally for the cloud service. + * <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as + * 'DeploymentId' for querying details. + * + * @return the privateIds value. + */ + List privateIds(); + + /** + * Gets the statuses property: The statuses property. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInstanceViewInner object. + * + * @return the inner object. + */ + CloudServiceInstanceViewInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceListResult.java new file mode 100644 index 0000000000000..e4718b4ea533e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CloudServiceListResult model. */ +@Fluent +public final class CloudServiceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the CloudServiceListResult object itself. + */ + public CloudServiceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the CloudServiceListResult object itself. + */ + public CloudServiceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model CloudServiceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceNetworkProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceNetworkProfile.java new file mode 100644 index 0000000000000..91c134d0febf6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceNetworkProfile.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network Profile for the cloud service. */ +@Fluent +public final class CloudServiceNetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceNetworkProfile.class); + + /* + * List of Load balancer configurations. Cloud service can have up to two + * load balancer configurations, corresponding to a Public Load Balancer + * and an Internal Load Balancer. + */ + @JsonProperty(value = "loadBalancerConfigurations") + private List loadBalancerConfigurations; + + /* + * The id reference of the cloud service containing the target IP with + * which the subject cloud service can perform a swap. This property cannot + * be updated once it is set. The swappable cloud service referred by this + * id must be present otherwise an error will be thrown. + */ + @JsonProperty(value = "swappableCloudService") + private SubResource swappableCloudService; + + /** + * Get the loadBalancerConfigurations property: List of Load balancer configurations. Cloud service can have up to + * two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. + * + * @return the loadBalancerConfigurations value. + */ + public List loadBalancerConfigurations() { + return this.loadBalancerConfigurations; + } + + /** + * Set the loadBalancerConfigurations property: List of Load balancer configurations. Cloud service can have up to + * two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. + * + * @param loadBalancerConfigurations the loadBalancerConfigurations value to set. + * @return the CloudServiceNetworkProfile object itself. + */ + public CloudServiceNetworkProfile withLoadBalancerConfigurations( + List loadBalancerConfigurations) { + this.loadBalancerConfigurations = loadBalancerConfigurations; + return this; + } + + /** + * Get the swappableCloudService property: The id reference of the cloud service containing the target IP with which + * the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud + * service referred by this id must be present otherwise an error will be thrown. + * + * @return the swappableCloudService value. + */ + public SubResource swappableCloudService() { + return this.swappableCloudService; + } + + /** + * Set the swappableCloudService property: The id reference of the cloud service containing the target IP with which + * the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud + * service referred by this id must be present otherwise an error will be thrown. + * + * @param swappableCloudService the swappableCloudService value to set. + * @return the CloudServiceNetworkProfile object itself. + */ + public CloudServiceNetworkProfile withSwappableCloudService(SubResource swappableCloudService) { + this.swappableCloudService = swappableCloudService; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (loadBalancerConfigurations() != null) { + loadBalancerConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOperatingSystems.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOperatingSystems.java new file mode 100644 index 0000000000000..20799c93f4534 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOperatingSystems.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 CloudServiceOperatingSystems. */ +public interface CloudServiceOperatingSystems { + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + OSVersion getOSVersion(String location, String osVersionName); + + /** + * Gets properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS version pertains to. + * @param osVersionName Name of the OS version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system version that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + Response getOSVersionWithResponse(String location, String osVersionName, Context context); + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + PagedIterable listOSVersions(String location); + + /** + * Gets a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS versions. Do this + * till nextLink is null to fetch all the OS versions. + * + * @param location Name of the location that the OS versions pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system versions available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + PagedIterable listOSVersions(String location, Context context); + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + OSFamily getOSFamily(String location, String osFamilyName); + + /** + * Gets properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service. + * + * @param location Name of the location that the OS family pertains to. + * @param osFamilyName Name of the OS family. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a guest operating system family that can be specified in the XML service configuration + * (.cscfg) for a cloud service along with {@link Response}. + */ + Response getOSFamilyWithResponse(String location, String osFamilyName, Context context); + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + PagedIterable listOSFamilies(String location); + + /** + * Gets a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. Use nextLink property in the response to get the next page of OS Families. Do this + * till nextLink is null to fetch all the OS Families. + * + * @param location Name of the location that the OS families pertain to. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all guest operating system families available to be specified in the XML service configuration + * (.cscfg) for a cloud service. + */ + PagedIterable listOSFamilies(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOsProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOsProfile.java new file mode 100644 index 0000000000000..1293b5243f1fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceOsProfile.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the OS profile for the cloud service. */ +@Fluent +public final class CloudServiceOsProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceOsProfile.class); + + /* + * Specifies set of certificates that should be installed onto the role + * instances. + */ + @JsonProperty(value = "secrets") + private List secrets; + + /** + * Get the secrets property: Specifies set of certificates that should be installed onto the role instances. + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: Specifies set of certificates that should be installed onto the role instances. + * + * @param secrets the secrets value to set. + * @return the CloudServiceOsProfile object itself. + */ + public CloudServiceOsProfile withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (secrets() != null) { + secrets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceProperties.java new file mode 100644 index 0000000000000..1a55331e8bf6a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceProperties.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cloud service properties. */ +@Fluent +public final class CloudServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceProperties.class); + + /* + * Specifies a URL that refers to the location of the service package in + * the Blob service. The service package URL can be Shared Access Signature + * (SAS) URI from any storage account. + * This is a write-only property and is not returned in GET calls. + */ + @JsonProperty(value = "packageUrl") + private String packageUrl; + + /* + * Specifies the XML service configuration (.cscfg) for the cloud service. + */ + @JsonProperty(value = "configuration") + private String configuration; + + /* + * Specifies a URL that refers to the location of the service configuration + * in the Blob service. The service package URL can be Shared Access + * Signature (SAS) URI from any storage account. + * This is a write-only property and is not returned in GET calls. + */ + @JsonProperty(value = "configurationUrl") + private String configurationUrl; + + /* + * (Optional) Indicates whether to start the cloud service immediately + * after it is created. The default value is `true`. + * If false, the service model is still deployed, but the code is not run + * immediately. Instead, the service is PoweredOff until you call Start, at + * which time the service will be started. A deployed service still incurs + * charges, even if it is poweredoff. + */ + @JsonProperty(value = "startCloudService") + private Boolean startCloudService; + + /* + * (Optional) Indicates whether the role sku properties + * (roleProfile.roles.sku) specified in the model/template should override + * the role instance count and vm size specified in the .cscfg and .csdef + * respectively. + * The default value is `false`. + */ + @JsonProperty(value = "allowModelOverride") + private Boolean allowModelOverride; + + /* + * Update mode for the cloud service. Role instances are allocated to + * update domains when the service is deployed. Updates can be initiated + * manually in each update domain or initiated automatically in all update + * domains. + * Possible Values are

    **Auto**

    **Manual**

    **Simultaneous**

    + * If not specified, the default value is Auto. If set to Manual, PUT + * UpdateDomain must be called to apply the update. If set to Auto, the + * update is automatically applied to each update domain in sequence. + */ + @JsonProperty(value = "upgradeMode") + private CloudServiceUpgradeMode upgradeMode; + + /* + * Describes the role profile for the cloud service. + */ + @JsonProperty(value = "roleProfile") + private CloudServiceRoleProfile roleProfile; + + /* + * Describes the OS profile for the cloud service. + */ + @JsonProperty(value = "osProfile") + private CloudServiceOsProfile osProfile; + + /* + * Network Profile for the cloud service. + */ + @JsonProperty(value = "networkProfile") + private CloudServiceNetworkProfile networkProfile; + + /* + * Describes a cloud service extension profile. + */ + @JsonProperty(value = "extensionProfile") + private CloudServiceExtensionProfile extensionProfile; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique identifier for the cloud service. + */ + @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueId; + + /** + * Get the packageUrl property: Specifies a URL that refers to the location of the service package in the Blob + * service. The service package URL can be Shared Access Signature (SAS) URI from any storage account. This is a + * write-only property and is not returned in GET calls. + * + * @return the packageUrl value. + */ + public String packageUrl() { + return this.packageUrl; + } + + /** + * Set the packageUrl property: Specifies a URL that refers to the location of the service package in the Blob + * service. The service package URL can be Shared Access Signature (SAS) URI from any storage account. This is a + * write-only property and is not returned in GET calls. + * + * @param packageUrl the packageUrl value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withPackageUrl(String packageUrl) { + this.packageUrl = packageUrl; + return this; + } + + /** + * Get the configuration property: Specifies the XML service configuration (.cscfg) for the cloud service. + * + * @return the configuration value. + */ + public String configuration() { + return this.configuration; + } + + /** + * Set the configuration property: Specifies the XML service configuration (.cscfg) for the cloud service. + * + * @param configuration the configuration value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withConfiguration(String configuration) { + this.configuration = configuration; + return this; + } + + /** + * Get the configurationUrl property: Specifies a URL that refers to the location of the service configuration in + * the Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage account. This + * is a write-only property and is not returned in GET calls. + * + * @return the configurationUrl value. + */ + public String configurationUrl() { + return this.configurationUrl; + } + + /** + * Set the configurationUrl property: Specifies a URL that refers to the location of the service configuration in + * the Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage account. This + * is a write-only property and is not returned in GET calls. + * + * @param configurationUrl the configurationUrl value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withConfigurationUrl(String configurationUrl) { + this.configurationUrl = configurationUrl; + return this; + } + + /** + * Get the startCloudService property: (Optional) Indicates whether to start the cloud service immediately after it + * is created. The default value is `true`. If false, the service model is still deployed, but the code is not run + * immediately. Instead, the service is PoweredOff until you call Start, at which time the service will be started. + * A deployed service still incurs charges, even if it is poweredoff. + * + * @return the startCloudService value. + */ + public Boolean startCloudService() { + return this.startCloudService; + } + + /** + * Set the startCloudService property: (Optional) Indicates whether to start the cloud service immediately after it + * is created. The default value is `true`. If false, the service model is still deployed, but the code is not run + * immediately. Instead, the service is PoweredOff until you call Start, at which time the service will be started. + * A deployed service still incurs charges, even if it is poweredoff. + * + * @param startCloudService the startCloudService value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withStartCloudService(Boolean startCloudService) { + this.startCloudService = startCloudService; + return this; + } + + /** + * Get the allowModelOverride property: (Optional) Indicates whether the role sku properties (roleProfile.roles.sku) + * specified in the model/template should override the role instance count and vm size specified in the .cscfg and + * .csdef respectively. The default value is `false`. + * + * @return the allowModelOverride value. + */ + public Boolean allowModelOverride() { + return this.allowModelOverride; + } + + /** + * Set the allowModelOverride property: (Optional) Indicates whether the role sku properties (roleProfile.roles.sku) + * specified in the model/template should override the role instance count and vm size specified in the .cscfg and + * .csdef respectively. The default value is `false`. + * + * @param allowModelOverride the allowModelOverride value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withAllowModelOverride(Boolean allowModelOverride) { + this.allowModelOverride = allowModelOverride; + return this; + } + + /** + * Get the upgradeMode property: Update mode for the cloud service. Role instances are allocated to update domains + * when the service is deployed. Updates can be initiated manually in each update domain or initiated automatically + * in all update domains. Possible Values are <br /><br />**Auto**<br /><br />**Manual** + * <br /><br />**Simultaneous**<br /><br /> If not specified, the default value is Auto. If + * set to Manual, PUT UpdateDomain must be called to apply the update. If set to Auto, the update is automatically + * applied to each update domain in sequence. + * + * @return the upgradeMode value. + */ + public CloudServiceUpgradeMode upgradeMode() { + return this.upgradeMode; + } + + /** + * Set the upgradeMode property: Update mode for the cloud service. Role instances are allocated to update domains + * when the service is deployed. Updates can be initiated manually in each update domain or initiated automatically + * in all update domains. Possible Values are <br /><br />**Auto**<br /><br />**Manual** + * <br /><br />**Simultaneous**<br /><br /> If not specified, the default value is Auto. If + * set to Manual, PUT UpdateDomain must be called to apply the update. If set to Auto, the update is automatically + * applied to each update domain in sequence. + * + * @param upgradeMode the upgradeMode value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withUpgradeMode(CloudServiceUpgradeMode upgradeMode) { + this.upgradeMode = upgradeMode; + return this; + } + + /** + * Get the roleProfile property: Describes the role profile for the cloud service. + * + * @return the roleProfile value. + */ + public CloudServiceRoleProfile roleProfile() { + return this.roleProfile; + } + + /** + * Set the roleProfile property: Describes the role profile for the cloud service. + * + * @param roleProfile the roleProfile value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withRoleProfile(CloudServiceRoleProfile roleProfile) { + this.roleProfile = roleProfile; + return this; + } + + /** + * Get the osProfile property: Describes the OS profile for the cloud service. + * + * @return the osProfile value. + */ + public CloudServiceOsProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Describes the OS profile for the cloud service. + * + * @param osProfile the osProfile value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withOsProfile(CloudServiceOsProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the networkProfile property: Network Profile for the cloud service. + * + * @return the networkProfile value. + */ + public CloudServiceNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Network Profile for the cloud service. + * + * @param networkProfile the networkProfile value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withNetworkProfile(CloudServiceNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the extensionProfile property: Describes a cloud service extension profile. + * + * @return the extensionProfile value. + */ + public CloudServiceExtensionProfile extensionProfile() { + return this.extensionProfile; + } + + /** + * Set the extensionProfile property: Describes a cloud service extension profile. + * + * @param extensionProfile the extensionProfile value to set. + * @return the CloudServiceProperties object itself. + */ + public CloudServiceProperties withExtensionProfile(CloudServiceExtensionProfile extensionProfile) { + this.extensionProfile = extensionProfile; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueId property: The unique identifier for the cloud service. + * + * @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 (roleProfile() != null) { + roleProfile().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (extensionProfile() != null) { + extensionProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRole.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRole.java new file mode 100644 index 0000000000000..a3f2f8f745001 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRole.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner; + +/** An immutable client-side representation of CloudServiceRole. */ +public interface CloudServiceRole { + /** + * Gets the id property: Resource id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the sku property: Describes the cloud service role sku. + * + * @return the sku value. + */ + CloudServiceRoleSku sku(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + CloudServiceRoleProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner object. + * + * @return the inner object. + */ + CloudServiceRoleInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleInstances.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleInstances.java new file mode 100644 index 0000000000000..92bbf3e42d8ca --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleInstances.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.StreamResponse; +import com.azure.core.util.Context; +import java.io.InputStream; + +/** Resource collection API of CloudServiceRoleInstances. */ +public interface CloudServiceRoleInstances { + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Deletes a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service. + */ + RoleInstance get(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a role instance from a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role instance from a cloud service along with {@link Response}. + */ + Response getWithResponse( + String roleInstanceName, + String resourceGroupName, + String cloudServiceName, + InstanceViewTypes expand, + Context context); + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance. + */ + RoleInstanceView getInstanceView(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Retrieves information about the run-time state of a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of the role instance along with {@link Response}. + */ + Response getInstanceViewWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + PagedIterable list(String resourceGroupName, String cloudServiceName); + + /** + * Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next + * page of role instances. Do this till nextLink is null to fetch all the role instances. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param expand The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of all role instances in a cloud service. + */ + PagedIterable list( + String resourceGroupName, String cloudServiceName, InstanceViewTypes expand, Context context); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or + * worker roles and initializes the storage resources that are used by them. If you do not want to initialize + * storage resources, you can use Reimage Role Instance. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + InputStream getRemoteDesktopFile(String roleInstanceName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a remote desktop file for a role instance in a cloud service. + * + * @param roleInstanceName Name of the role instance. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a remote desktop file for a role instance in a cloud service. + */ + StreamResponse getRemoteDesktopFileWithResponse( + String roleInstanceName, String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleListResult.java new file mode 100644 index 0000000000000..ce10319363450 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleListResult.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CloudServiceRoleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CloudServiceRoleListResult model. */ +@Fluent +public final class CloudServiceRoleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the CloudServiceRoleListResult object itself. + */ + public CloudServiceRoleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the CloudServiceRoleListResult object itself. + */ + public CloudServiceRoleListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model CloudServiceRoleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfile.java new file mode 100644 index 0000000000000..7355b72bad2a9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfile.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the role profile for the cloud service. */ +@Fluent +public final class CloudServiceRoleProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleProfile.class); + + /* + * List of roles for the cloud service. + */ + @JsonProperty(value = "roles") + private List roles; + + /** + * Get the roles property: List of roles for the cloud service. + * + * @return the roles value. + */ + public List roles() { + return this.roles; + } + + /** + * Set the roles property: List of roles for the cloud service. + * + * @param roles the roles value to set. + * @return the CloudServiceRoleProfile object itself. + */ + public CloudServiceRoleProfile withRoles(List roles) { + this.roles = roles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roles() != null) { + roles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfileProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfileProperties.java new file mode 100644 index 0000000000000..8cf362a58a23c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProfileProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the role properties. */ +@Fluent +public final class CloudServiceRoleProfileProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleProfileProperties.class); + + /* + * Resource name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Describes the cloud service role sku. + */ + @JsonProperty(value = "sku") + private CloudServiceRoleSku sku; + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name. + * + * @param name the name value to set. + * @return the CloudServiceRoleProfileProperties object itself. + */ + public CloudServiceRoleProfileProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the sku property: Describes the cloud service role sku. + * + * @return the sku value. + */ + public CloudServiceRoleSku sku() { + return this.sku; + } + + /** + * Set the sku property: Describes the cloud service role sku. + * + * @param sku the sku value to set. + * @return the CloudServiceRoleProfileProperties object itself. + */ + public CloudServiceRoleProfileProperties withSku(CloudServiceRoleSku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProperties.java new file mode 100644 index 0000000000000..d67c702ba3d4a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CloudServiceRoleProperties model. */ +@Immutable +public final class CloudServiceRoleProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleProperties.class); + + /* + * Specifies the ID which uniquely identifies a cloud service role. + */ + @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueId; + + /** + * Get the uniqueId property: Specifies the ID which uniquely identifies a cloud service role. + * + * @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() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleSku.java new file mode 100644 index 0000000000000..bf04f72f30bde --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoleSku.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the cloud service role sku. */ +@Fluent +public final class CloudServiceRoleSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceRoleSku.class); + + /* + * The sku name. NOTE: If the new SKU is not supported on the hardware the + * cloud service is currently on, you need to delete and recreate the cloud + * service or move back to the old sku. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the tier of the cloud service. Possible Values are

    **Standard**

    **Basic** + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Specifies the number of role instances in the cloud service. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name property: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is + * currently on, you need to delete and recreate the cloud service or move back to the old sku. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is + * currently on, you need to delete and recreate the cloud service or move back to the old sku. + * + * @param name the name value to set. + * @return the CloudServiceRoleSku object itself. + */ + public CloudServiceRoleSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Specifies the tier of the cloud service. Possible Values are <br /><br /> + * **Standard** <br /><br /> **Basic**. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Specifies the tier of the cloud service. Possible Values are <br /><br /> + * **Standard** <br /><br /> **Basic**. + * + * @param tier the tier value to set. + * @return the CloudServiceRoleSku object itself. + */ + public CloudServiceRoleSku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity property: Specifies the number of role instances in the cloud service. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Specifies the number of role instances in the cloud service. + * + * @param capacity the capacity value to set. + * @return the CloudServiceRoleSku object itself. + */ + public CloudServiceRoleSku withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoles.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoles.java new file mode 100644 index 0000000000000..13a4ef9085cd5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceRoles.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 CloudServiceRoles. */ +public interface CloudServiceRoles { + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service. + */ + CloudServiceRole get(String roleName, String resourceGroupName, String cloudServiceName); + + /** + * Gets a role from a cloud service. + * + * @param roleName Name of the role. + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role from a cloud service along with {@link Response}. + */ + Response getWithResponse( + String roleName, String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + PagedIterable list(String resourceGroupName, String cloudServiceName); + + /** + * Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. + * Do this till nextLink is null to fetch all the roles. + * + * @param resourceGroupName The resourceGroupName parameter. + * @param cloudServiceName The cloudServiceName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all roles in a cloud service. + */ + PagedIterable list(String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpdate.java new file mode 100644 index 0000000000000..950dd5e4c83bc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The CloudServiceUpdate model. */ +@Fluent +public final class CloudServiceUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceUpdate.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 CloudServiceUpdate object itself. + */ + public CloudServiceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpgradeMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpgradeMode.java new file mode 100644 index 0000000000000..ff81b9b432d31 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceUpgradeMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CloudServiceUpgradeMode. */ +public final class CloudServiceUpgradeMode extends ExpandableStringEnum { + /** Static value Auto for CloudServiceUpgradeMode. */ + public static final CloudServiceUpgradeMode AUTO = fromString("Auto"); + + /** Static value Manual for CloudServiceUpgradeMode. */ + public static final CloudServiceUpgradeMode MANUAL = fromString("Manual"); + + /** Static value Simultaneous for CloudServiceUpgradeMode. */ + public static final CloudServiceUpgradeMode SIMULTANEOUS = fromString("Simultaneous"); + + /** + * Creates or finds a CloudServiceUpgradeMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudServiceUpgradeMode. + */ + @JsonCreator + public static CloudServiceUpgradeMode fromString(String name) { + return fromString(name, CloudServiceUpgradeMode.class); + } + + /** @return known CloudServiceUpgradeMode values. */ + public static Collection values() { + return values(CloudServiceUpgradeMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultAndSecretReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultAndSecretReference.java new file mode 100644 index 0000000000000..f6282c0b84a82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultAndSecretReference.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CloudServiceVaultAndSecretReference model. */ +@Fluent +public final class CloudServiceVaultAndSecretReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceVaultAndSecretReference.class); + + /* + * The sourceVault property. + */ + @JsonProperty(value = "sourceVault") + private SubResource sourceVault; + + /* + * The secretUrl property. + */ + @JsonProperty(value = "secretUrl") + private String secretUrl; + + /** + * Get the sourceVault property: The sourceVault property. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The sourceVault property. + * + * @param sourceVault the sourceVault value to set. + * @return the CloudServiceVaultAndSecretReference object itself. + */ + public CloudServiceVaultAndSecretReference withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the secretUrl property: The secretUrl property. + * + * @return the secretUrl value. + */ + public String secretUrl() { + return this.secretUrl; + } + + /** + * Set the secretUrl property: The secretUrl property. + * + * @param secretUrl the secretUrl value to set. + * @return the CloudServiceVaultAndSecretReference object itself. + */ + public CloudServiceVaultAndSecretReference withSecretUrl(String secretUrl) { + this.secretUrl = secretUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultCertificate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultCertificate.java new file mode 100644 index 0000000000000..17f3ebb82af9d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultCertificate.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role + * instance. + */ +@Fluent +public final class CloudServiceVaultCertificate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceVaultCertificate.class); + + /* + * This is the URL of a certificate that has been uploaded to Key Vault as + * a secret. + */ + @JsonProperty(value = "certificateUrl") + private String certificateUrl; + + /** + * Get the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. + * + * @return the certificateUrl value. + */ + public String certificateUrl() { + return this.certificateUrl; + } + + /** + * Set the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. + * + * @param certificateUrl the certificateUrl value to set. + * @return the CloudServiceVaultCertificate object itself. + */ + public CloudServiceVaultCertificate withCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultSecretGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultSecretGroup.java new file mode 100644 index 0000000000000..e7937a9931b0c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServiceVaultSecretGroup.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a set of certificates which are all in the same Key Vault. */ +@Fluent +public final class CloudServiceVaultSecretGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceVaultSecretGroup.class); + + /* + * The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + */ + @JsonProperty(value = "sourceVault") + private SubResource sourceVault; + + /* + * The list of key vault references in SourceVault which contain + * certificates. + */ + @JsonProperty(value = "vaultCertificates") + private List vaultCertificates; + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @param sourceVault the sourceVault value to set. + * @return the CloudServiceVaultSecretGroup object itself. + */ + public CloudServiceVaultSecretGroup withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @return the vaultCertificates value. + */ + public List vaultCertificates() { + return this.vaultCertificates; + } + + /** + * Set the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @param vaultCertificates the vaultCertificates value to set. + * @return the CloudServiceVaultSecretGroup object itself. + */ + public CloudServiceVaultSecretGroup withVaultCertificates(List vaultCertificates) { + this.vaultCertificates = vaultCertificates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vaultCertificates() != null) { + vaultCertificates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServices.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServices.java new file mode 100644 index 0000000000000..d6fc84cfbf249 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServices.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 CloudServices. */ +public interface CloudServices { + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cloudServiceName); + + /** + * Deletes a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 cloudServiceName, Context context); + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service. + */ + CloudService getByResourceGroup(String resourceGroupName, String cloudServiceName); + + /** + * Display information about a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service. + */ + CloudServiceInstanceView getInstanceView(String resourceGroupName, String cloudServiceName); + + /** + * Gets the status of a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a cloud service along with {@link Response}. + */ + Response getInstanceViewWithResponse( + String resourceGroupName, String cloudServiceName, Context context); + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + PagedIterable list(); + + /** + * Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the + * Cloud Services. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services in the subscription, regardless of the associated resource group. + */ + PagedIterable list(Context context); + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next + * page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + * + * @param resourceGroupName Name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all cloud services under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName); + + /** + * Starts the cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, Context context); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String cloudServiceName); + + /** + * Power off the cloud service. Note that resources are still attached and you are getting charged for the + * resources. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String cloudServiceName, Context context); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName); + + /** + * Restarts one or more role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String cloudServiceName); + + /** + * Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(String resourceGroupName, String cloudServiceName); + + /** + * Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes + * the storage resources that are used by them. If you do not want to initialize storage resources, you can use + * Reimage Role Instances. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rebuild(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(String resourceGroupName, String cloudServiceName); + + /** + * Deletes role instances in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param parameters List of cloud service role instance names. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(String resourceGroupName, String cloudServiceName, RoleInstances parameters, Context context); + + /** + * Display information about a cloud service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response}. + */ + CloudService getById(String id); + + /** + * Display information about a cloud service. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the cloud service along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a cloud service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 a cloud service. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 CloudService resource. + * + * @param name resource name. + * @return the first stage of the new CloudService definition. + */ + CloudService.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServicesUpdateDomains.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServicesUpdateDomains.java new file mode 100644 index 0000000000000..b11fd7c55854e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CloudServicesUpdateDomains.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.UpdateDomainInner; + +/** Resource collection API of CloudServicesUpdateDomains. */ +public interface CloudServicesUpdateDomains { + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void walkUpdateDomain( + String resourceGroupName, String cloudServiceName, int updateDomain, UpdateDomainInner parameters); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void walkUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain); + + /** + * Updates the role instances in the specified update domain. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param parameters The update domain object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void walkUpdateDomain( + String resourceGroupName, + String cloudServiceName, + int updateDomain, + UpdateDomainInner parameters, + Context context); + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 update domain of a cloud service. + */ + UpdateDomain getUpdateDomain(String resourceGroupName, String cloudServiceName, int updateDomain); + + /** + * Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page + * of update domains. Do this till nextLink is null to fetch all the update domains. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param updateDomain Specifies an integer value that identifies the update domain. Update domains are identified + * with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 update domain of a cloud service along with {@link Response}. + */ + Response getUpdateDomainWithResponse( + String resourceGroupName, String cloudServiceName, int updateDomain, Context context); + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + PagedIterable listUpdateDomains(String resourceGroupName, String cloudServiceName); + + /** + * Gets a list of all update domains in a cloud service. + * + * @param resourceGroupName Name of the resource group. + * @param cloudServiceName Name of the cloud service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all update domains in a cloud service. + */ + PagedIterable listUpdateDomains(String resourceGroupName, String cloudServiceName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleries.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleries.java new file mode 100644 index 0000000000000..4bca355e8fa4c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleries.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CommunityGalleries. */ +public interface CommunityGalleries { + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name. + */ + CommunityGallery get(String location, String publicGalleryName); + + /** + * Get a community gallery by gallery public name. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery by gallery public name along with {@link Response}. + */ + Response getWithResponse(String location, String publicGalleryName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGallery.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGallery.java new file mode 100644 index 0000000000000..be72d49959b99 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGallery.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryInner; + +/** An immutable client-side representation of CommunityGallery. */ +public interface CommunityGallery { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the uniqueId property: The unique id of this community gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryInner object. + * + * @return the inner object. + */ + CommunityGalleryInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImage.java new file mode 100644 index 0000000000000..8f26f5632ec52 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImage.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of CommunityGalleryImage. */ +public interface CommunityGalleryImage { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the uniqueId property: The unique id of this community gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the osType property: This property allows you to specify the type of the OS that is included in the disk + * when creating a VM from a managed image. <br><br> Possible values are: <br><br> + * **Windows** <br><br> **Linux**. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + OperatingSystemStateTypes osState(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + GalleryImageIdentifier identifier(); + + /** + * Gets the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + RecommendedMachineConfiguration recommended(); + + /** + * Gets the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + Disallowed disallowed(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the features property: A list of gallery image features. + * + * @return the features value. + */ + List features(); + + /** + * Gets the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + ImagePurchasePlan purchasePlan(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageInner object. + * + * @return the inner object. + */ + CommunityGalleryImageInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersion.java new file mode 100644 index 0000000000000..108565e6b0bbb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersion.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageVersionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of CommunityGalleryImageVersion. */ +public interface CommunityGalleryImageVersion { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the uniqueId property: The unique id of this community gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + OffsetDateTime publishedDate(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryImageVersionInner + * object. + * + * @return the inner object. + */ + CommunityGalleryImageVersionInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersions.java new file mode 100644 index 0000000000000..6d85d1d13fa3c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImageVersions.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CommunityGalleryImageVersions. */ +public interface CommunityGalleryImageVersions { + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version. + */ + CommunityGalleryImageVersion get( + String location, String publicGalleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Get a community gallery image version. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param galleryImageVersionName The name of the community gallery image version. Needs to follow semantic version + * name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit + * integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image version along with {@link Response}. + */ + Response getWithResponse( + String location, + String publicGalleryName, + String galleryImageName, + String galleryImageVersionName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImages.java new file mode 100644 index 0000000000000..c70dbeb29f7e8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CommunityGalleryImages.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CommunityGalleryImages. */ +public interface CommunityGalleryImages { + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image. + */ + CommunityGalleryImage get(String location, String publicGalleryName, String galleryImageName); + + /** + * Get a community gallery image. + * + * @param location Resource location. + * @param publicGalleryName The public name of the community gallery. + * @param galleryImageName The name of the community gallery image definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a community gallery image along with {@link Response}. + */ + Response getWithResponse( + String location, String publicGalleryName, String galleryImageName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComponentNames.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComponentNames.java new file mode 100644 index 0000000000000..080ac2c90927c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComponentNames.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ComponentNames. */ +public enum ComponentNames { + /** Enum value Microsoft-Windows-Shell-Setup. */ + MICROSOFT_WINDOWS_SHELL_SETUP("Microsoft-Windows-Shell-Setup"); + + /** The actual serialized value for a ComponentNames instance. */ + private final String value; + + ComponentNames(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComponentNames instance. + * + * @param value the serialized value to parse. + * @return the parsed ComponentNames object, or null if unable to parse. + */ + @JsonCreator + public static ComponentNames fromString(String value) { + ComponentNames[] items = ComponentNames.values(); + for (ComponentNames item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationListResult.java new file mode 100644 index 0000000000000..23f2168045df6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationListResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Compute Operation operation response. */ +@Immutable +public final class ComputeOperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeOperationListResult.class); + + /* + * The list of compute operations + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of compute operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationValue.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationValue.java new file mode 100644 index 0000000000000..3ce3b547c3208 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ComputeOperationValue.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner; + +/** An immutable client-side representation of ComputeOperationValue. */ +public interface ComputeOperationValue { + /** + * Gets the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the name property: The name of the compute operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + String resource(); + + /** + * Gets the description property: The description of the operation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + String provider(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.ComputeOperationValueInner object. + * + * @return the inner object. + */ + ComputeOperationValueInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ConsistencyModeTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ConsistencyModeTypes.java new file mode 100644 index 0000000000000..67e06ae53a387 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ConsistencyModeTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConsistencyModeTypes. */ +public final class ConsistencyModeTypes extends ExpandableStringEnum { + /** Static value CrashConsistent for ConsistencyModeTypes. */ + public static final ConsistencyModeTypes CRASH_CONSISTENT = fromString("CrashConsistent"); + + /** Static value FileSystemConsistent for ConsistencyModeTypes. */ + public static final ConsistencyModeTypes FILE_SYSTEM_CONSISTENT = fromString("FileSystemConsistent"); + + /** Static value ApplicationConsistent for ConsistencyModeTypes. */ + public static final ConsistencyModeTypes APPLICATION_CONSISTENT = fromString("ApplicationConsistent"); + + /** + * Creates or finds a ConsistencyModeTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConsistencyModeTypes. + */ + @JsonCreator + public static ConsistencyModeTypes fromString(String name) { + return fromString(name, ConsistencyModeTypes.class); + } + + /** @return known ConsistencyModeTypes values. */ + public static Collection values() { + return values(ConsistencyModeTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CreationData.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CreationData.java new file mode 100644 index 0000000000000..45ee99a7d87b1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/CreationData.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Data used when creating a disk. */ +@Fluent +public final class CreationData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreationData.class); + + /* + * This enumerates the possible sources of a disk's creation. + */ + @JsonProperty(value = "createOption", required = true) + private DiskCreateOption createOption; + + /* + * Required if createOption is Import. The Azure Resource Manager + * identifier of the storage account containing the blob to import as a + * disk. + */ + @JsonProperty(value = "storageAccountId") + private String storageAccountId; + + /* + * Disk source information. + */ + @JsonProperty(value = "imageReference") + private ImageDiskReference imageReference; + + /* + * Required if creating from a Gallery Image. The id of the + * ImageDiskReference will be the ARM id of the shared galley image version + * from which to create a disk. + */ + @JsonProperty(value = "galleryImageReference") + private ImageDiskReference galleryImageReference; + + /* + * If createOption is Import, this is the URI of a blob to be imported into + * a managed disk. + */ + @JsonProperty(value = "sourceUri") + private String sourceUri; + + /* + * If createOption is Copy, this is the ARM id of the source snapshot or + * disk. + */ + @JsonProperty(value = "sourceResourceId") + private String sourceResourceId; + + /* + * If this field is set, this is the unique id identifying the source of + * this resource. + */ + @JsonProperty(value = "sourceUniqueId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceUniqueId; + + /* + * If createOption is Upload, this is the size of the contents of the + * upload including the VHD footer. This value should be between 20972032 + * (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + * + 512 bytes for the VHD footer). + */ + @JsonProperty(value = "uploadSizeBytes") + private Long uploadSizeBytes; + + /* + * Logical sector size in bytes for Ultra disks. Supported values are 512 + * ad 4096. 4096 is the default. + */ + @JsonProperty(value = "logicalSectorSize") + private Integer logicalSectorSize; + + /* + * If createOption is ImportSecure, this is the URI of a blob to be + * imported into VM guest state. + */ + @JsonProperty(value = "securityDataUri") + private String securityDataUri; + + /** + * Get the createOption property: This enumerates the possible sources of a disk's creation. + * + * @return the createOption value. + */ + public DiskCreateOption createOption() { + return this.createOption; + } + + /** + * Set the createOption property: This enumerates the possible sources of a disk's creation. + * + * @param createOption the createOption value to set. + * @return the CreationData object itself. + */ + public CreationData withCreateOption(DiskCreateOption createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the storageAccountId property: Required if createOption is Import. The Azure Resource Manager identifier of + * the storage account containing the blob to import as a disk. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: Required if createOption is Import. The Azure Resource Manager identifier of + * the storage account containing the blob to import as a disk. + * + * @param storageAccountId the storageAccountId value to set. + * @return the CreationData object itself. + */ + public CreationData withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the imageReference property: Disk source information. + * + * @return the imageReference value. + */ + public ImageDiskReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Disk source information. + * + * @param imageReference the imageReference value to set. + * @return the CreationData object itself. + */ + public CreationData withImageReference(ImageDiskReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the galleryImageReference property: Required if creating from a Gallery Image. The id of the + * ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. + * + * @return the galleryImageReference value. + */ + public ImageDiskReference galleryImageReference() { + return this.galleryImageReference; + } + + /** + * Set the galleryImageReference property: Required if creating from a Gallery Image. The id of the + * ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. + * + * @param galleryImageReference the galleryImageReference value to set. + * @return the CreationData object itself. + */ + public CreationData withGalleryImageReference(ImageDiskReference galleryImageReference) { + this.galleryImageReference = galleryImageReference; + return this; + } + + /** + * Get the sourceUri property: If createOption is Import, this is the URI of a blob to be imported into a managed + * disk. + * + * @return the sourceUri value. + */ + public String sourceUri() { + return this.sourceUri; + } + + /** + * Set the sourceUri property: If createOption is Import, this is the URI of a blob to be imported into a managed + * disk. + * + * @param sourceUri the sourceUri value to set. + * @return the CreationData object itself. + */ + public CreationData withSourceUri(String sourceUri) { + this.sourceUri = sourceUri; + return this; + } + + /** + * Get the sourceResourceId property: If createOption is Copy, this is the ARM id of the source snapshot or disk. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: If createOption is Copy, this is the ARM id of the source snapshot or disk. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the CreationData object itself. + */ + public CreationData withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Get the sourceUniqueId property: If this field is set, this is the unique id identifying the source of this + * resource. + * + * @return the sourceUniqueId value. + */ + public String sourceUniqueId() { + return this.sourceUniqueId; + } + + /** + * Get the uploadSizeBytes property: If createOption is Upload, this is the size of the contents of the upload + * including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and + * 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + * + * @return the uploadSizeBytes value. + */ + public Long uploadSizeBytes() { + return this.uploadSizeBytes; + } + + /** + * Set the uploadSizeBytes property: If createOption is Upload, this is the size of the contents of the upload + * including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and + * 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + * + * @param uploadSizeBytes the uploadSizeBytes value to set. + * @return the CreationData object itself. + */ + public CreationData withUploadSizeBytes(Long uploadSizeBytes) { + this.uploadSizeBytes = uploadSizeBytes; + return this; + } + + /** + * Get the logicalSectorSize property: Logical sector size in bytes for Ultra disks. Supported values are 512 ad + * 4096. 4096 is the default. + * + * @return the logicalSectorSize value. + */ + public Integer logicalSectorSize() { + return this.logicalSectorSize; + } + + /** + * Set the logicalSectorSize property: Logical sector size in bytes for Ultra disks. Supported values are 512 ad + * 4096. 4096 is the default. + * + * @param logicalSectorSize the logicalSectorSize value to set. + * @return the CreationData object itself. + */ + public CreationData withLogicalSectorSize(Integer logicalSectorSize) { + this.logicalSectorSize = logicalSectorSize; + return this; + } + + /** + * Get the securityDataUri property: If createOption is ImportSecure, this is the URI of a blob to be imported into + * VM guest state. + * + * @return the securityDataUri value. + */ + public String securityDataUri() { + return this.securityDataUri; + } + + /** + * Set the securityDataUri property: If createOption is ImportSecure, this is the URI of a blob to be imported into + * VM guest state. + * + * @param securityDataUri the securityDataUri value to set. + * @return the CreationData object itself. + */ + public CreationData withSecurityDataUri(String securityDataUri) { + this.securityDataUri = securityDataUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property createOption in model CreationData")); + } + if (imageReference() != null) { + imageReference().validate(); + } + if (galleryImageReference() != null) { + galleryImageReference().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDisk.java new file mode 100644 index 0000000000000..d93b785f00e44 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDisk.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a data disk. */ +@Fluent +public final class DataDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDisk.class); + + /* + * Specifies the logical unit number of the data disk. This value is used + * to identify data disks within the VM and therefore must be unique for + * each data disk attached to a VM. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The virtual hard disk. + */ + @JsonProperty(value = "vhd") + private VirtualHardDisk vhd; + + /* + * The source user image virtual hard disk. The virtual hard disk will be + * copied before being attached to the virtual machine. If SourceImage is + * provided, the destination virtual hard drive must not exist. + */ + @JsonProperty(value = "image") + private VirtualHardDisk image; + + /* + * Specifies the caching requirements.

    Possible values are: + *

    **None**

    **ReadOnly**

    **ReadWrite**

    + * Default: **None for Standard storage. ReadOnly for Premium storage** + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + */ + @JsonProperty(value = "writeAcceleratorEnabled") + private Boolean writeAcceleratorEnabled; + + /* + * Specifies how the virtual machine should be created.

    Possible + * values are:

    **Attach** \u2013 This value is used when you are + * using a specialized disk to create the virtual machine.

    + * **FromImage** \u2013 This value is used when you are using an image to + * create the virtual machine. If you are using a platform image, you also + * use the imageReference element described above. If you are using a + * marketplace image, you also use the plan element previously described. + */ + @JsonProperty(value = "createOption", required = true) + private DiskCreateOptionTypes createOption; + + /* + * Specifies the size of an empty data disk in gigabytes. This element can + * be used to overwrite the size of the disk in a virtual machine image. + *

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The managed disk parameters. + */ + @JsonProperty(value = "managedDisk") + private ManagedDiskParameters managedDisk; + + /* + * Specifies whether the data disk is in process of detachment from the + * VirtualMachine/VirtualMachineScaleset + */ + @JsonProperty(value = "toBeDetached") + private Boolean toBeDetached; + + /* + * Specifies the Read-Write IOPS for the managed disk when + * StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine + * ScaleSet VM disks. Can be updated only via updates to the VirtualMachine + * Scale Set. + */ + @JsonProperty(value = "diskIOPSReadWrite", access = JsonProperty.Access.WRITE_ONLY) + private Long diskIopsReadWrite; + + /* + * Specifies the bandwidth in MB per second for the managed disk when + * StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine + * ScaleSet VM disks. Can be updated only via updates to the VirtualMachine + * Scale Set. + */ + @JsonProperty(value = "diskMBpsReadWrite", access = JsonProperty.Access.WRITE_ONLY) + private Long diskMBpsReadWrite; + + /* + * Specifies the detach behavior to be used while detaching a disk or which + * is already in the process of detachment from the virtual machine. + * Supported values: **ForceDetach**.

    detachOption: + * **ForceDetach** is applicable only for managed data disks. If a previous + * detachment attempt of the data disk did not complete due to an + * unexpected failure from the virtual machine and the disk is still not + * released then use force-detach as a last resort option to detach the + * disk forcibly from the VM. All writes might not have been flushed when + * using this detach behavior.

    This feature is still in preview + * mode and is not supported for VirtualMachineScaleSet. To force-detach a + * data disk update toBeDetached to 'true' along with setting detachOption: + * 'ForceDetach'. + */ + @JsonProperty(value = "detachOption") + private DiskDetachOptionTypes detachOption; + + /* + * Specifies whether data disk should be deleted or detached upon VM + * deletion.

    Possible values:

    **Delete** If this value is + * used, the data disk is deleted when VM is deleted.

    **Detach** If + * this value is used, the data disk is retained after VM is + * deleted.

    The default value is set to **detach** + */ + @JsonProperty(value = "deleteOption") + private DiskDeleteOptionTypes deleteOption; + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @param lun the lun value to set. + * @return the DataDisk object itself. + */ + public DataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the DataDisk object itself. + */ + public DataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the vhd property: The virtual hard disk. + * + * @return the vhd value. + */ + public VirtualHardDisk vhd() { + return this.vhd; + } + + /** + * Set the vhd property: The virtual hard disk. + * + * @param vhd the vhd value to set. + * @return the DataDisk object itself. + */ + public DataDisk withVhd(VirtualHardDisk vhd) { + this.vhd = vhd; + return this; + } + + /** + * Get the image property: The source user image virtual hard disk. The virtual hard disk will be copied before + * being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not + * exist. + * + * @return the image value. + */ + public VirtualHardDisk image() { + return this.image; + } + + /** + * Set the image property: The source user image virtual hard disk. The virtual hard disk will be copied before + * being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not + * exist. + * + * @param image the image value to set. + * @return the DataDisk object itself. + */ + public DataDisk withImage(VirtualHardDisk image) { + this.image = image; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @param caching the caching value to set. + * @return the DataDisk object itself. + */ + public DataDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the DataDisk object itself. + */ + public DataDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the createOption property: Specifies how the virtual machine should be created.<br><br> Possible + * values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to + * create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an + * image to create the virtual machine. If you are using a platform image, you also use the imageReference element + * described above. If you are using a marketplace image, you also use the plan element previously described. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: Specifies how the virtual machine should be created.<br><br> Possible + * values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to + * create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an + * image to create the virtual machine. If you are using a platform image, you also use the imageReference element + * described above. If you are using a marketplace image, you also use the plan element previously described. + * + * @param createOption the createOption value to set. + * @return the DataDisk object itself. + */ + public DataDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DataDisk object itself. + */ + public DataDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public ManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the DataDisk object itself. + */ + public DataDisk withManagedDisk(ManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the toBeDetached property: Specifies whether the data disk is in process of detachment from the + * VirtualMachine/VirtualMachineScaleset. + * + * @return the toBeDetached value. + */ + public Boolean toBeDetached() { + return this.toBeDetached; + } + + /** + * Set the toBeDetached property: Specifies whether the data disk is in process of detachment from the + * VirtualMachine/VirtualMachineScaleset. + * + * @param toBeDetached the toBeDetached value to set. + * @return the DataDisk object itself. + */ + public DataDisk withToBeDetached(Boolean toBeDetached) { + this.toBeDetached = toBeDetached; + return this; + } + + /** + * Get the diskIopsReadWrite property: Specifies the Read-Write IOPS for the managed disk when StorageAccountType is + * UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the + * VirtualMachine Scale Set. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.diskIopsReadWrite; + } + + /** + * Get the diskMBpsReadWrite property: Specifies the bandwidth in MB per second for the managed disk when + * StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via + * updates to the VirtualMachine Scale Set. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.diskMBpsReadWrite; + } + + /** + * Get the detachOption property: Specifies the detach behavior to be used while detaching a disk or which is + * already in the process of detachment from the virtual machine. Supported values: **ForceDetach**. + * <br><br> detachOption: **ForceDetach** is applicable only for managed data disks. If a previous + * detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and + * the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the + * VM. All writes might not have been flushed when using this detach behavior. <br><br> This feature is + * still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update + * toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + * + * @return the detachOption value. + */ + public DiskDetachOptionTypes detachOption() { + return this.detachOption; + } + + /** + * Set the detachOption property: Specifies the detach behavior to be used while detaching a disk or which is + * already in the process of detachment from the virtual machine. Supported values: **ForceDetach**. + * <br><br> detachOption: **ForceDetach** is applicable only for managed data disks. If a previous + * detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and + * the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the + * VM. All writes might not have been flushed when using this detach behavior. <br><br> This feature is + * still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update + * toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + * + * @param detachOption the detachOption value to set. + * @return the DataDisk object itself. + */ + public DataDisk withDetachOption(DiskDetachOptionTypes detachOption) { + this.detachOption = detachOption; + return this; + } + + /** + * Get the deleteOption property: Specifies whether data disk should be deleted or detached upon VM + * deletion.<br><br> Possible values: <br><br> **Delete** If this value is used, the data + * disk is deleted when VM is deleted.<br><br> **Detach** If this value is used, the data disk is + * retained after VM is deleted.<br><br> The default value is set to **detach**. + * + * @return the deleteOption value. + */ + public DiskDeleteOptionTypes deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specifies whether data disk should be deleted or detached upon VM + * deletion.<br><br> Possible values: <br><br> **Delete** If this value is used, the data + * disk is deleted when VM is deleted.<br><br> **Detach** If this value is used, the data disk is + * retained after VM is deleted.<br><br> The default value is set to **detach**. + * + * @param deleteOption the deleteOption value to set. + * @return the DataDisk object itself. + */ + public DataDisk withDeleteOption(DiskDeleteOptionTypes deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vhd() != null) { + vhd().validate(); + } + if (image() != null) { + image().validate(); + } + if (createOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property createOption in model DataDisk")); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImage.java new file mode 100644 index 0000000000000..cb0fd07ce29b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImage.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the data disk images information. */ +@Immutable +public final class DataDiskImage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDiskImage.class); + + /* + * Specifies the logical unit number of the data disk. This value is used + * to identify data disks within the VM and therefore must be unique for + * each data disk attached to a VM. + */ + @JsonProperty(value = "lun", access = JsonProperty.Access.WRITE_ONLY) + private Integer lun; + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImageEncryption.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImageEncryption.java new file mode 100644 index 0000000000000..8eadc3a5a6996 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DataDiskImageEncryption.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains encryption settings for a data disk image. */ +@Fluent +public final class DataDiskImageEncryption extends DiskImageEncryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDiskImageEncryption.class); + + /* + * This property specifies the logical unit number of the data disk. This + * value is used to identify data disks within the Virtual Machine and + * therefore must be unique for each data disk attached to the Virtual + * Machine. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /** + * Get the lun property: This property specifies the logical unit number of the data disk. This value is used to + * identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the + * Virtual Machine. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: This property specifies the logical unit number of the data disk. This value is used to + * identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the + * Virtual Machine. + * + * @param lun the lun value to set. + * @return the DataDiskImageEncryption object itself. + */ + public DataDiskImageEncryption withLun(int lun) { + this.lun = lun; + return this; + } + + /** {@inheritDoc} */ + @Override + public DataDiskImageEncryption withDiskEncryptionSetId(String diskEncryptionSetId) { + super.withDiskEncryptionSetId(diskEncryptionSetId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHost.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHost.java new file mode 100644 index 0000000000000..8aae180fa734d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHost.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DedicatedHost. */ +public interface DedicatedHost { + /** + * 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 sku property: SKU of the dedicated host for Hardware Generation and VM family. Only name is required to + * be set. List Microsoft.Compute SKUs for a list of possible values. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @return the autoReplaceOnFailure value. + */ + Boolean autoReplaceOnFailure(); + + /** + * Gets the hostId property: A unique id generated and assigned to the dedicated host by the platform. + * <br><br> Does not change throughout the lifetime of the host. + * + * @return the hostId value. + */ + String hostId(); + + /** + * Gets the virtualMachines property: A list of references to all virtual machines in the Dedicated Host. + * + * @return the virtualMachines value. + */ + List virtualMachines(); + + /** + * Gets the licenseType property: Specifies the software license type that will be applied to the VMs deployed on + * the dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @return the licenseType value. + */ + DedicatedHostLicenseTypes licenseType(); + + /** + * Gets the provisioningTime property: The date when the host was first provisioned. + * + * @return the provisioningTime value. + */ + OffsetDateTime provisioningTime(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The dedicated host instance view. + * + * @return the instanceView value. + */ + DedicatedHostInstanceView instanceView(); + + /** + * Gets the timeCreated property: Specifies the time at which the Dedicated Host resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner object. + * + * @return the inner object. + */ + DedicatedHostInner innerModel(); + + /** The entirety of the DedicatedHost definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The DedicatedHost definition stages. */ + interface DefinitionStages { + /** The first stage of the DedicatedHost definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DedicatedHost definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the DedicatedHost definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, hostGroupName. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @return the next definition stage. + */ + WithSku withExistingHostGroup(String resourceGroupName, String hostGroupName); + } + /** The stage of the DedicatedHost definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the dedicated host for Hardware Generation and VM family. Only name is + * required to be set. List Microsoft.Compute SKUs for a list of possible values.. + * + * @param sku SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be + * set. List Microsoft.Compute SKUs for a list of possible values. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** + * The stage of the DedicatedHost 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.WithPlatformFaultDomain, + DefinitionStages.WithAutoReplaceOnFailure, + DefinitionStages.WithLicenseType { + /** + * Executes the create request. + * + * @return the created resource. + */ + DedicatedHost create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DedicatedHost create(Context context); + } + /** The stage of the DedicatedHost 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 DedicatedHost definition allowing to specify platformFaultDomain. */ + interface WithPlatformFaultDomain { + /** + * Specifies the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host + * group.. + * + * @param platformFaultDomain Fault domain of the dedicated host within a dedicated host group. + * @return the next definition stage. + */ + WithCreate withPlatformFaultDomain(Integer platformFaultDomain); + } + /** The stage of the DedicatedHost definition allowing to specify autoReplaceOnFailure. */ + interface WithAutoReplaceOnFailure { + /** + * Specifies the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced + * automatically in case of a failure. The value is defaulted to 'true' when not provided.. + * + * @param autoReplaceOnFailure Specifies whether the dedicated host should be replaced automatically in case + * of a failure. The value is defaulted to 'true' when not provided. + * @return the next definition stage. + */ + WithCreate withAutoReplaceOnFailure(Boolean autoReplaceOnFailure); + } + /** The stage of the DedicatedHost definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies the software license type that will be applied to the VMs + * deployed on the dedicated host. <br><br> Possible values are: <br><br> **None** + * <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** + * <br><br> Default: **None**. + * + * @param licenseType Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** + * <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** + * <br><br> Default: **None**. + * @return the next definition stage. + */ + WithCreate withLicenseType(DedicatedHostLicenseTypes licenseType); + } + } + /** + * Begins update for the DedicatedHost resource. + * + * @return the stage of resource update. + */ + DedicatedHost.Update update(); + + /** The template for DedicatedHost update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithPlatformFaultDomain, + UpdateStages.WithAutoReplaceOnFailure, + UpdateStages.WithLicenseType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DedicatedHost apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DedicatedHost apply(Context context); + } + /** The DedicatedHost update stages. */ + interface UpdateStages { + /** The stage of the DedicatedHost 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 DedicatedHost update allowing to specify platformFaultDomain. */ + interface WithPlatformFaultDomain { + /** + * Specifies the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host + * group.. + * + * @param platformFaultDomain Fault domain of the dedicated host within a dedicated host group. + * @return the next definition stage. + */ + Update withPlatformFaultDomain(Integer platformFaultDomain); + } + /** The stage of the DedicatedHost update allowing to specify autoReplaceOnFailure. */ + interface WithAutoReplaceOnFailure { + /** + * Specifies the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced + * automatically in case of a failure. The value is defaulted to 'true' when not provided.. + * + * @param autoReplaceOnFailure Specifies whether the dedicated host should be replaced automatically in case + * of a failure. The value is defaulted to 'true' when not provided. + * @return the next definition stage. + */ + Update withAutoReplaceOnFailure(Boolean autoReplaceOnFailure); + } + /** The stage of the DedicatedHost update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies the software license type that will be applied to the VMs + * deployed on the dedicated host. <br><br> Possible values are: <br><br> **None** + * <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** + * <br><br> Default: **None**. + * + * @param licenseType Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** + * <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** + * <br><br> Default: **None**. + * @return the next definition stage. + */ + Update withLicenseType(DedicatedHostLicenseTypes licenseType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DedicatedHost refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DedicatedHost refresh(Context context); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAllocatableVM.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAllocatableVM.java new file mode 100644 index 0000000000000..869ee774976b2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAllocatableVM.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the dedicated host unutilized capacity in terms of a specific VM size. */ +@Fluent +public final class DedicatedHostAllocatableVM { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostAllocatableVM.class); + + /* + * VM size in terms of which the unutilized capacity is represented. + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /* + * Maximum number of VMs of size vmSize that can fit in the dedicated + * host's remaining capacity. + */ + @JsonProperty(value = "count") + private Double count; + + /** + * Get the vmSize property: VM size in terms of which the unutilized capacity is represented. + * + * @return the vmSize value. + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: VM size in terms of which the unutilized capacity is represented. + * + * @param vmSize the vmSize value to set. + * @return the DedicatedHostAllocatableVM object itself. + */ + public DedicatedHostAllocatableVM withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the count property: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining + * capacity. + * + * @return the count value. + */ + public Double count() { + return this.count; + } + + /** + * Set the count property: Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining + * capacity. + * + * @param count the count value to set. + * @return the DedicatedHostAllocatableVM object itself. + */ + public DedicatedHostAllocatableVM withCount(Double count) { + this.count = count; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAvailableCapacity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAvailableCapacity.java new file mode 100644 index 0000000000000..15d11b7141e25 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostAvailableCapacity.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Dedicated host unutilized capacity. */ +@Fluent +public final class DedicatedHostAvailableCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostAvailableCapacity.class); + + /* + * The unutilized capacity of the dedicated host represented in terms of + * each VM size that is allowed to be deployed to the dedicated host. + */ + @JsonProperty(value = "allocatableVMs") + private List allocatableVMs; + + /** + * Get the allocatableVMs property: The unutilized capacity of the dedicated host represented in terms of each VM + * size that is allowed to be deployed to the dedicated host. + * + * @return the allocatableVMs value. + */ + public List allocatableVMs() { + return this.allocatableVMs; + } + + /** + * Set the allocatableVMs property: The unutilized capacity of the dedicated host represented in terms of each VM + * size that is allowed to be deployed to the dedicated host. + * + * @param allocatableVMs the allocatableVMs value to set. + * @return the DedicatedHostAvailableCapacity object itself. + */ + public DedicatedHostAvailableCapacity withAllocatableVMs(List allocatableVMs) { + this.allocatableVMs = allocatableVMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allocatableVMs() != null) { + allocatableVMs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroup.java new file mode 100644 index 0000000000000..6104aa5b58c2a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroup.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DedicatedHostGroup. */ +public interface DedicatedHostGroup { + /** + * 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 zones property: Availability Zone to use for this host group. Only single zone is supported. The zone + * can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @return the platformFaultDomainCount value. + */ + int platformFaultDomainCount(); + + /** + * Gets the hosts property: A list of references to all dedicated hosts in the dedicated host group. + * + * @return the hosts value. + */ + List hosts(); + + /** + * Gets the instanceView property: The dedicated host group instance view, which has the list of instance view of + * the dedicated hosts under the dedicated host group. + * + * @return the instanceView value. + */ + DedicatedHostGroupInstanceView instanceView(); + + /** + * Gets the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @return the supportAutomaticPlacement value. + */ + Boolean supportAutomaticPlacement(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner object. + * + * @return the inner object. + */ + DedicatedHostGroupInner innerModel(); + + /** The entirety of the DedicatedHostGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DedicatedHostGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the DedicatedHostGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DedicatedHostGroup 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 DedicatedHostGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DedicatedHostGroup 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.WithZones, + DefinitionStages.WithPlatformFaultDomainCount, + DefinitionStages.WithSupportAutomaticPlacement { + /** + * Executes the create request. + * + * @return the created resource. + */ + DedicatedHostGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DedicatedHostGroup create(Context context); + } + /** The stage of the DedicatedHostGroup 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 DedicatedHostGroup definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: Availability Zone to use for this host group. Only single zone is + * supported. The zone can be assigned only during creation. If not provided, the group supports all zones + * in the region. If provided, enforces each host in the group to be in the same zone.. + * + * @param zones Availability Zone to use for this host group. Only single zone is supported. The zone can be + * assigned only during creation. If not provided, the group supports all zones in the region. If + * provided, enforces each host in the group to be in the same zone. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + /** The stage of the DedicatedHostGroup definition allowing to specify platformFaultDomainCount. */ + interface WithPlatformFaultDomainCount { + /** + * Specifies the platformFaultDomainCount property: Number of fault domains that the host group can span.. + * + * @param platformFaultDomainCount Number of fault domains that the host group can span. + * @return the next definition stage. + */ + WithCreate withPlatformFaultDomainCount(int platformFaultDomainCount); + } + /** The stage of the DedicatedHostGroup definition allowing to specify supportAutomaticPlacement. */ + interface WithSupportAutomaticPlacement { + /** + * Specifies the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine + * scale sets can be placed automatically on the dedicated host group. Automatic placement means resources + * are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is + * defaulted to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01.. + * + * @param supportAutomaticPlacement Specifies whether virtual machines or virtual machine scale sets can be + * placed automatically on the dedicated host group. Automatic placement means resources are allocated + * on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted + * to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01. + * @return the next definition stage. + */ + WithCreate withSupportAutomaticPlacement(Boolean supportAutomaticPlacement); + } + } + /** + * Begins update for the DedicatedHostGroup resource. + * + * @return the stage of resource update. + */ + DedicatedHostGroup.Update update(); + + /** The template for DedicatedHostGroup update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithZones, + UpdateStages.WithPlatformFaultDomainCount, + UpdateStages.WithSupportAutomaticPlacement { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DedicatedHostGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DedicatedHostGroup apply(Context context); + } + /** The DedicatedHostGroup update stages. */ + interface UpdateStages { + /** The stage of the DedicatedHostGroup 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 DedicatedHostGroup update allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: Availability Zone to use for this host group. Only single zone is + * supported. The zone can be assigned only during creation. If not provided, the group supports all zones + * in the region. If provided, enforces each host in the group to be in the same zone.. + * + * @param zones Availability Zone to use for this host group. Only single zone is supported. The zone can be + * assigned only during creation. If not provided, the group supports all zones in the region. If + * provided, enforces each host in the group to be in the same zone. + * @return the next definition stage. + */ + Update withZones(List zones); + } + /** The stage of the DedicatedHostGroup update allowing to specify platformFaultDomainCount. */ + interface WithPlatformFaultDomainCount { + /** + * Specifies the platformFaultDomainCount property: Number of fault domains that the host group can span.. + * + * @param platformFaultDomainCount Number of fault domains that the host group can span. + * @return the next definition stage. + */ + Update withPlatformFaultDomainCount(int platformFaultDomainCount); + } + /** The stage of the DedicatedHostGroup update allowing to specify supportAutomaticPlacement. */ + interface WithSupportAutomaticPlacement { + /** + * Specifies the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine + * scale sets can be placed automatically on the dedicated host group. Automatic placement means resources + * are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is + * defaulted to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01.. + * + * @param supportAutomaticPlacement Specifies whether virtual machines or virtual machine scale sets can be + * placed automatically on the dedicated host group. Automatic placement means resources are allocated + * on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted + * to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01. + * @return the next definition stage. + */ + Update withSupportAutomaticPlacement(Boolean supportAutomaticPlacement); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DedicatedHostGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DedicatedHostGroup refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupInstanceView.java new file mode 100644 index 0000000000000..5407415534983 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupInstanceView.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The DedicatedHostGroupInstanceView model. */ +@Fluent +public final class DedicatedHostGroupInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupInstanceView.class); + + /* + * List of instance view of the dedicated hosts under the dedicated host + * group. + */ + @JsonProperty(value = "hosts") + private List hosts; + + /** + * Get the hosts property: List of instance view of the dedicated hosts under the dedicated host group. + * + * @return the hosts value. + */ + public List hosts() { + return this.hosts; + } + + /** + * Set the hosts property: List of instance view of the dedicated hosts under the dedicated host group. + * + * @param hosts the hosts value to set. + * @return the DedicatedHostGroupInstanceView object itself. + */ + public DedicatedHostGroupInstanceView withHosts(List hosts) { + this.hosts = hosts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hosts() != null) { + hosts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupListResult.java new file mode 100644 index 0000000000000..dcb4c2f73fa4a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Dedicated Host Group with resource group response. */ +@Fluent +public final class DedicatedHostGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupListResult.class); + + /* + * The list of dedicated host groups + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of Dedicated Host Groups. Call ListNext() + * with this URI to fetch the next page of Dedicated Host Groups. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of dedicated host groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of dedicated host groups. + * + * @param value the value value to set. + * @return the DedicatedHostGroupListResult object itself. + */ + public DedicatedHostGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI + * to fetch the next page of Dedicated Host Groups. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI + * to fetch the next page of Dedicated Host Groups. + * + * @param nextLink the nextLink value to set. + * @return the DedicatedHostGroupListResult object itself. + */ + public DedicatedHostGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model DedicatedHostGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupUpdate.java new file mode 100644 index 0000000000000..a41ceefc12a14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroupUpdate.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostGroupProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be + * updated. + */ +@Fluent +public final class DedicatedHostGroupUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostGroupUpdate.class); + + /* + * Dedicated Host Group Properties. + */ + @JsonProperty(value = "properties") + private DedicatedHostGroupProperties innerProperties; + + /* + * Availability Zone to use for this host group. Only single zone is + * supported. The zone can be assigned only during creation. If not + * provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the innerProperties property: Dedicated Host Group Properties. + * + * @return the innerProperties value. + */ + private DedicatedHostGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the zones property: Availability Zone to use for this host group. Only single zone is supported. The zone can + * be assigned only during creation. If not provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Availability Zone to use for this host group. Only single zone is supported. The zone can + * be assigned only during creation. If not provided, the group supports all zones in the region. If provided, + * enforces each host in the group to be in the same zone. + * + * @param zones the zones value to set. + * @return the DedicatedHostGroupUpdate object itself. + */ + public DedicatedHostGroupUpdate withZones(List zones) { + this.zones = zones; + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostGroupUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomainCount(); + } + + /** + * Set the platformFaultDomainCount property: Number of fault domains that the host group can span. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the DedicatedHostGroupUpdate object itself. + */ + public DedicatedHostGroupUpdate withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostGroupProperties(); + } + this.innerProperties().withPlatformFaultDomainCount(platformFaultDomainCount); + return this; + } + + /** + * Get the hosts property: A list of references to all dedicated hosts in the dedicated host group. + * + * @return the hosts value. + */ + public List hosts() { + return this.innerProperties() == null ? null : this.innerProperties().hosts(); + } + + /** + * Get the instanceView property: The dedicated host group instance view, which has the list of instance view of the + * dedicated hosts under the dedicated host group. + * + * @return the instanceView value. + */ + public DedicatedHostGroupInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @return the supportAutomaticPlacement value. + */ + public Boolean supportAutomaticPlacement() { + return this.innerProperties() == null ? null : this.innerProperties().supportAutomaticPlacement(); + } + + /** + * Set the supportAutomaticPlacement property: Specifies whether virtual machines or virtual machine scale sets can + * be placed automatically on the dedicated host group. Automatic placement means resources are allocated on + * dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when + * not provided. <br><br>Minimum api-version: 2020-06-01. + * + * @param supportAutomaticPlacement the supportAutomaticPlacement value to set. + * @return the DedicatedHostGroupUpdate object itself. + */ + public DedicatedHostGroupUpdate withSupportAutomaticPlacement(Boolean supportAutomaticPlacement) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostGroupProperties(); + } + this.innerProperties().withSupportAutomaticPlacement(supportAutomaticPlacement); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroups.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroups.java new file mode 100644 index 0000000000000..125cd8bd57073 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostGroups.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 DedicatedHostGroups. */ +public interface DedicatedHostGroups { + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName); + + /** + * Delete a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteWithResponse(String resourceGroupName, String hostGroupName, Context context); + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to. + */ + DedicatedHostGroup getByResourceGroup(String resourceGroupName, String hostGroupName); + + /** + * Retrieves information about a dedicated host group. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String hostGroupName, InstanceViewTypes expand, Context context); + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the dedicated host groups in the specified resource group. Use the nextLink property in the response + * to get the next page of dedicated host groups. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + PagedIterable list(); + + /** + * Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the + * next page of dedicated host groups. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Dedicated Host Group with resource group response. + */ + PagedIterable list(Context context); + + /** + * Retrieves information about a dedicated host group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + DedicatedHostGroup getById(String id); + + /** + * Retrieves information about a dedicated host group. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host + * group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the dedicated host group that the dedicated hosts should be assigned to along + * with {@link Response}. + */ + Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context); + + /** + * Delete a dedicated host group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a dedicated host 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.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DedicatedHostGroup resource. + * + * @param name resource name. + * @return the first stage of the new DedicatedHostGroup definition. + */ + DedicatedHostGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceView.java new file mode 100644 index 0000000000000..866ceabe66593 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceView.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a dedicated host. */ +@Fluent +public class DedicatedHostInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostInstanceView.class); + + /* + * Specifies the unique id of the dedicated physical machine on which the + * dedicated host resides. + */ + @JsonProperty(value = "assetId", access = JsonProperty.Access.WRITE_ONLY) + private String assetId; + + /* + * Unutilized capacity of the dedicated host. + */ + @JsonProperty(value = "availableCapacity") + private DedicatedHostAvailableCapacity availableCapacity; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the assetId property: Specifies the unique id of the dedicated physical machine on which the dedicated host + * resides. + * + * @return the assetId value. + */ + public String assetId() { + return this.assetId; + } + + /** + * Get the availableCapacity property: Unutilized capacity of the dedicated host. + * + * @return the availableCapacity value. + */ + public DedicatedHostAvailableCapacity availableCapacity() { + return this.availableCapacity; + } + + /** + * Set the availableCapacity property: Unutilized capacity of the dedicated host. + * + * @param availableCapacity the availableCapacity value to set. + * @return the DedicatedHostInstanceView object itself. + */ + public DedicatedHostInstanceView withAvailableCapacity(DedicatedHostAvailableCapacity availableCapacity) { + this.availableCapacity = availableCapacity; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the DedicatedHostInstanceView object itself. + */ + public DedicatedHostInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availableCapacity() != null) { + availableCapacity().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceViewWithName.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceViewWithName.java new file mode 100644 index 0000000000000..9e487ad08c392 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostInstanceViewWithName.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to + * the instance view of a dedicated host group. + */ +@Fluent +public final class DedicatedHostInstanceViewWithName extends DedicatedHostInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostInstanceViewWithName.class); + + /* + * The name of the dedicated host. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the name property: The name of the dedicated host. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostInstanceViewWithName withAvailableCapacity(DedicatedHostAvailableCapacity availableCapacity) { + super.withAvailableCapacity(availableCapacity); + return this; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostInstanceViewWithName withStatuses(List statuses) { + super.withStatuses(statuses); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostLicenseTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostLicenseTypes.java new file mode 100644 index 0000000000000..ba5b2a9d2c974 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostLicenseTypes.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DedicatedHostLicenseTypes. */ +public enum DedicatedHostLicenseTypes { + /** Enum value None. */ + NONE("None"), + + /** Enum value Windows_Server_Hybrid. */ + WINDOWS_SERVER_HYBRID("Windows_Server_Hybrid"), + + /** Enum value Windows_Server_Perpetual. */ + WINDOWS_SERVER_PERPETUAL("Windows_Server_Perpetual"); + + /** The actual serialized value for a DedicatedHostLicenseTypes instance. */ + private final String value; + + DedicatedHostLicenseTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DedicatedHostLicenseTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed DedicatedHostLicenseTypes object, or null if unable to parse. + */ + @JsonCreator + public static DedicatedHostLicenseTypes fromString(String value) { + DedicatedHostLicenseTypes[] items = DedicatedHostLicenseTypes.values(); + for (DedicatedHostLicenseTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostListResult.java new file mode 100644 index 0000000000000..f20133d551d94 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list dedicated host operation response. */ +@Fluent +public final class DedicatedHostListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostListResult.class); + + /* + * The list of dedicated hosts + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of dedicated hosts. Call ListNext() with + * this URI to fetch the next page of dedicated hosts. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of dedicated hosts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of dedicated hosts. + * + * @param value the value value to set. + * @return the DedicatedHostListResult object itself. + */ + public DedicatedHostListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to + * fetch the next page of dedicated hosts. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to + * fetch the next page of dedicated hosts. + * + * @param nextLink the nextLink value to set. + * @return the DedicatedHostListResult object itself. + */ + public DedicatedHostListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DedicatedHostListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostUpdate.java new file mode 100644 index 0000000000000..a80125621b1f3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHostUpdate.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DedicatedHostProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated. */ +@Fluent +public final class DedicatedHostUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DedicatedHostUpdate.class); + + /* + * Properties of the dedicated host. + */ + @JsonProperty(value = "properties") + private DedicatedHostProperties innerProperties; + + /** + * Get the innerProperties property: Properties of the dedicated host. + * + * @return the innerProperties value. + */ + private DedicatedHostProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DedicatedHostUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @return the platformFaultDomain value. + */ + public Integer platformFaultDomain() { + return this.innerProperties() == null ? null : this.innerProperties().platformFaultDomain(); + } + + /** + * Set the platformFaultDomain property: Fault domain of the dedicated host within a dedicated host group. + * + * @param platformFaultDomain the platformFaultDomain value to set. + * @return the DedicatedHostUpdate object itself. + */ + public DedicatedHostUpdate withPlatformFaultDomain(Integer platformFaultDomain) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withPlatformFaultDomain(platformFaultDomain); + return this; + } + + /** + * Get the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @return the autoReplaceOnFailure value. + */ + public Boolean autoReplaceOnFailure() { + return this.innerProperties() == null ? null : this.innerProperties().autoReplaceOnFailure(); + } + + /** + * Set the autoReplaceOnFailure property: Specifies whether the dedicated host should be replaced automatically in + * case of a failure. The value is defaulted to 'true' when not provided. + * + * @param autoReplaceOnFailure the autoReplaceOnFailure value to set. + * @return the DedicatedHostUpdate object itself. + */ + public DedicatedHostUpdate withAutoReplaceOnFailure(Boolean autoReplaceOnFailure) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withAutoReplaceOnFailure(autoReplaceOnFailure); + return this; + } + + /** + * Get the hostId property: A unique id generated and assigned to the dedicated host by the platform. + * <br><br> Does not change throughout the lifetime of the host. + * + * @return the hostId value. + */ + public String hostId() { + return this.innerProperties() == null ? null : this.innerProperties().hostId(); + } + + /** + * Get the virtualMachines property: A list of references to all virtual machines in the Dedicated Host. + * + * @return the virtualMachines value. + */ + public List virtualMachines() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachines(); + } + + /** + * Get the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @return the licenseType value. + */ + public DedicatedHostLicenseTypes licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: Specifies the software license type that will be applied to the VMs deployed on the + * dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> + * **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: + * **None**. + * + * @param licenseType the licenseType value to set. + * @return the DedicatedHostUpdate object itself. + */ + public DedicatedHostUpdate withLicenseType(DedicatedHostLicenseTypes licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new DedicatedHostProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the provisioningTime property: The date when the host was first provisioned. + * + * @return the provisioningTime value. + */ + public OffsetDateTime provisioningTime() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningTime(); + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The dedicated host instance view. + * + * @return the instanceView value. + */ + public DedicatedHostInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Get the timeCreated property: Specifies the time at which the Dedicated Host resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHosts.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHosts.java new file mode 100644 index 0000000000000..4b8eabedd7336 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DedicatedHosts.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 DedicatedHosts. */ +public interface DedicatedHosts { + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName, String hostname); + + /** + * Delete a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 hostGroupName, String hostname, Context context); + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host. + */ + DedicatedHost get(String resourceGroupName, String hostGroupName, String hostname); + + /** + * Retrieves information about a dedicated host. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String hostGroupName, String hostname, InstanceViewTypes expand, Context context); + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName); + + /** + * Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in the response + * to get the next page of dedicated hosts. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list dedicated host operation response. + */ + PagedIterable listByHostGroup(String resourceGroupName, String hostGroupName, Context context); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname); + + /** + * Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is + * running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource + * Health Center in the Azure Portal. Please refer to + * https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more details. + * + * @param resourceGroupName The name of the resource group. + * @param hostGroupName The name of the dedicated host group. + * @param hostname The name of the dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String hostGroupName, String hostname, Context context); + + /** + * Retrieves information about a dedicated host. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response}. + */ + DedicatedHost getById(String id); + + /** + * Retrieves information about a dedicated host. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance + * views of the dedicated host. 'UserData' is not supported for dedicated host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Dedicated host along with {@link Response}. + */ + Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context); + + /** + * Delete a dedicated host. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a dedicated host. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 DedicatedHost resource. + * + * @param name resource name. + * @return the first stage of the new DedicatedHost definition. + */ + DedicatedHost.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DeleteOptions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DeleteOptions.java new file mode 100644 index 0000000000000..ef3601376fe0a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DeleteOptions.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DeleteOptions. */ +public final class DeleteOptions extends ExpandableStringEnum { + /** Static value Delete for DeleteOptions. */ + public static final DeleteOptions DELETE = fromString("Delete"); + + /** Static value Detach for DeleteOptions. */ + public static final DeleteOptions DETACH = fromString("Detach"); + + /** + * Creates or finds a DeleteOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeleteOptions. + */ + @JsonCreator + public static DeleteOptions fromString(String name) { + return fromString(name, DeleteOptions.class); + } + + /** @return known DeleteOptions values. */ + public static Collection values() { + return values(DeleteOptions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiagnosticsProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiagnosticsProfile.java new file mode 100644 index 0000000000000..ee1020e100515 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiagnosticsProfile.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. */ +@Fluent +public final class DiagnosticsProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticsProfile.class); + + /* + * Boot Diagnostics is a debugging feature which allows you to view Console + * Output and Screenshot to diagnose VM status.
    **NOTE**: If storageUri + * is being specified then ensure that the storage account is in the same + * region and subscription as the VM.

    You can easily view the + * output of your console log.

    Azure also enables you to see a + * screenshot of the VM from the hypervisor. + */ + @JsonProperty(value = "bootDiagnostics") + private BootDiagnostics bootDiagnostics; + + /** + * Get the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br>**NOTE**: If storageUri is being specified then ensure that the + * storage account is in the same region and subscription as the VM. <br><br> You can easily view the + * output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the + * hypervisor. + * + * @return the bootDiagnostics value. + */ + public BootDiagnostics bootDiagnostics() { + return this.bootDiagnostics; + } + + /** + * Set the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. <br>**NOTE**: If storageUri is being specified then ensure that the + * storage account is in the same region and subscription as the VM. <br><br> You can easily view the + * output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the + * hypervisor. + * + * @param bootDiagnostics the bootDiagnostics value to set. + * @return the DiagnosticsProfile object itself. + */ + public DiagnosticsProfile withBootDiagnostics(BootDiagnostics bootDiagnostics) { + this.bootDiagnostics = bootDiagnostics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (bootDiagnostics() != null) { + bootDiagnostics().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskOptions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskOptions.java new file mode 100644 index 0000000000000..47cbde396a03c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskOptions.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiffDiskOptions. */ +public final class DiffDiskOptions extends ExpandableStringEnum { + /** Static value Local for DiffDiskOptions. */ + public static final DiffDiskOptions LOCAL = fromString("Local"); + + /** + * Creates or finds a DiffDiskOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffDiskOptions. + */ + @JsonCreator + public static DiffDiskOptions fromString(String name) { + return fromString(name, DiffDiskOptions.class); + } + + /** @return known DiffDiskOptions values. */ + public static Collection values() { + return values(DiffDiskOptions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskPlacement.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskPlacement.java new file mode 100644 index 0000000000000..f951a0de6d883 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskPlacement.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiffDiskPlacement. */ +public final class DiffDiskPlacement extends ExpandableStringEnum { + /** Static value CacheDisk for DiffDiskPlacement. */ + public static final DiffDiskPlacement CACHE_DISK = fromString("CacheDisk"); + + /** Static value ResourceDisk for DiffDiskPlacement. */ + public static final DiffDiskPlacement RESOURCE_DISK = fromString("ResourceDisk"); + + /** + * Creates or finds a DiffDiskPlacement from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffDiskPlacement. + */ + @JsonCreator + public static DiffDiskPlacement fromString(String name) { + return fromString(name, DiffDiskPlacement.class); + } + + /** @return known DiffDiskPlacement values. */ + public static Collection values() { + return values(DiffDiskPlacement.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskSettings.java new file mode 100644 index 0000000000000..df8ef81f24e01 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiffDiskSettings.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the parameters of ephemeral disk settings that can be specified for operating system disk. + * <br><br> NOTE: The ephemeral disk settings can only be specified for managed disk. + */ +@Fluent +public final class DiffDiskSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiffDiskSettings.class); + + /* + * Specifies the ephemeral disk settings for operating system disk. + */ + @JsonProperty(value = "option") + private DiffDiskOptions option; + + /* + * Specifies the ephemeral disk placement for operating system + * disk.

    Possible values are:

    **CacheDisk**

    + * **ResourceDisk**

    Default: **CacheDisk** if one is configured + * for the VM size otherwise **ResourceDisk** is used.

    Refer to VM + * size documentation for Windows VM at + * https://docs.microsoft.com/azure/virtual-machines/windows/sizes and + * Linux VM at + * https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check + * which VM sizes exposes a cache disk. + */ + @JsonProperty(value = "placement") + private DiffDiskPlacement placement; + + /** + * Get the option property: Specifies the ephemeral disk settings for operating system disk. + * + * @return the option value. + */ + public DiffDiskOptions option() { + return this.option; + } + + /** + * Set the option property: Specifies the ephemeral disk settings for operating system disk. + * + * @param option the option value to set. + * @return the DiffDiskSettings object itself. + */ + public DiffDiskSettings withOption(DiffDiskOptions option) { + this.option = option; + return this; + } + + /** + * Get the placement property: Specifies the ephemeral disk placement for operating system disk.<br><br> + * Possible values are: <br><br> **CacheDisk** <br><br> **ResourceDisk** + * <br><br> Default: **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** is + * used.<br><br> Refer to VM size documentation for Windows VM at + * https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + * https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. + * + * @return the placement value. + */ + public DiffDiskPlacement placement() { + return this.placement; + } + + /** + * Set the placement property: Specifies the ephemeral disk placement for operating system disk.<br><br> + * Possible values are: <br><br> **CacheDisk** <br><br> **ResourceDisk** + * <br><br> Default: **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** is + * used.<br><br> Refer to VM size documentation for Windows VM at + * https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + * https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. + * + * @param placement the placement value to set. + * @return the DiffDiskSettings object itself. + */ + public DiffDiskSettings withPlacement(DiffDiskPlacement placement) { + this.placement = placement; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disallowed.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disallowed.java new file mode 100644 index 0000000000000..984e1880763b7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disallowed.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the disallowed disk types. */ +@Fluent +public final class Disallowed { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Disallowed.class); + + /* + * A list of disk types. + */ + @JsonProperty(value = "diskTypes") + private List diskTypes; + + /** + * Get the diskTypes property: A list of disk types. + * + * @return the diskTypes value. + */ + public List diskTypes() { + return this.diskTypes; + } + + /** + * Set the diskTypes property: A list of disk types. + * + * @param diskTypes the diskTypes value to set. + * @return the Disallowed object itself. + */ + public Disallowed withDiskTypes(List diskTypes) { + this.diskTypes = diskTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DisallowedConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DisallowedConfiguration.java new file mode 100644 index 0000000000000..02b3f5c1273ad --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DisallowedConfiguration.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the disallowed configuration for a virtual machine image. */ +@Fluent +public final class DisallowedConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DisallowedConfiguration.class); + + /* + * VM disk types which are disallowed. + */ + @JsonProperty(value = "vmDiskType") + private VmDiskTypes vmDiskType; + + /** + * Get the vmDiskType property: VM disk types which are disallowed. + * + * @return the vmDiskType value. + */ + public VmDiskTypes vmDiskType() { + return this.vmDiskType; + } + + /** + * Set the vmDiskType property: VM disk types which are disallowed. + * + * @param vmDiskType the vmDiskType value to set. + * @return the DisallowedConfiguration object itself. + */ + public DisallowedConfiguration withVmDiskType(VmDiskTypes vmDiskType) { + this.vmDiskType = vmDiskType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disk.java new file mode 100644 index 0000000000000..63f3dd0105606 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disk.java @@ -0,0 +1,1023 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Disk. */ +public interface Disk { + /** + * 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 managedBy property: A relative URI containing the ID of the VM that has the disk attached. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the managedByExtended property: List of relative URIs containing the IDs of the VMs that have the disk + * attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. + * + * @return the managedByExtended value. + */ + List managedByExtended(); + + /** + * Gets the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * + * @return the sku value. + */ + DiskSku sku(); + + /** + * Gets the zones property: The Logical zone list for Disk. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the extendedLocation property: The extended location where the disk will be created. Extended location + * cannot be changed. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the timeCreated property: The time when the disk was created. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the osType property: The Operating System type. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @return the purchasePlan value. + */ + PurchasePlanAutoGenerated purchasePlan(); + + /** + * Gets the supportedCapabilities property: List of supported capabilities for the image from which the OS disk was + * created. + * + * @return the supportedCapabilities value. + */ + SupportedCapabilities supportedCapabilities(); + + /** + * Gets the creationData property: Disk source information. CreationData information cannot be changed after the + * disk has been created. + * + * @return the creationData value. + */ + CreationData creationData(); + + /** + * Gets the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + Integer diskSizeGB(); + + /** + * Gets the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + Long diskSizeBytes(); + + /** + * Gets the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk Encryption, + * can contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + EncryptionSettingsCollection encryptionSettingsCollection(); + + /** + * Gets the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadWrite value. + */ + Long diskIopsReadWrite(); + + /** + * Gets the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @return the diskMBpsReadWrite value. + */ + Long diskMBpsReadWrite(); + + /** + * Gets the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadOnly value. + */ + Long diskIopsReadOnly(); + + /** + * Gets the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @return the diskMBpsReadOnly value. + */ + Long diskMBpsReadOnly(); + + /** + * Gets the diskState property: The state of the disk. + * + * @return the diskState value. + */ + DiskState diskState(); + + /** + * Gets the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + Encryption encryption(); + + /** + * Gets 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. + */ + Integer maxShares(); + + /** + * Gets the shareInfo property: Details of the list of all VMs that have the disk attached. maxShares should be set + * to a value greater than one for disks to allow attaching them to multiple VMs. + * + * @return the shareInfo value. + */ + List shareInfo(); + + /** + * Gets the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + NetworkAccessPolicy networkAccessPolicy(); + + /** + * Gets the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + String diskAccessId(); + + /** + * Gets the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @return the tier value. + */ + String tier(); + + /** + * Gets the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of + * the disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @return the burstingEnabled value. + */ + Boolean burstingEnabled(); + + /** + * Gets the propertyUpdatesInProgress property: Properties of the disk for which update is pending. + * + * @return the propertyUpdatesInProgress value. + */ + PropertyUpdatesInProgress propertyUpdatesInProgress(); + + /** + * Gets the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + Boolean supportsHibernation(); + + /** + * Gets the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + DiskSecurityProfile securityProfile(); + + /** + * Gets the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + Float completionPercent(); + + /** + * Gets the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.DiskInner object. + * + * @return the inner object. + */ + DiskInner innerModel(); + + /** The entirety of the Disk definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Disk definition stages. */ + interface DefinitionStages { + /** The first stage of the Disk definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Disk 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 Disk definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Disk 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.WithSku, + DefinitionStages.WithZones, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithOsType, + DefinitionStages.WithHyperVGeneration, + DefinitionStages.WithPurchasePlan, + DefinitionStages.WithSupportedCapabilities, + DefinitionStages.WithCreationData, + DefinitionStages.WithDiskSizeGB, + DefinitionStages.WithEncryptionSettingsCollection, + DefinitionStages.WithDiskIopsReadWrite, + DefinitionStages.WithDiskMBpsReadWrite, + DefinitionStages.WithDiskIopsReadOnly, + DefinitionStages.WithDiskMBpsReadOnly, + DefinitionStages.WithEncryption, + DefinitionStages.WithMaxShares, + DefinitionStages.WithNetworkAccessPolicy, + DefinitionStages.WithDiskAccessId, + DefinitionStages.WithTier, + DefinitionStages.WithBurstingEnabled, + DefinitionStages.WithSupportsHibernation, + DefinitionStages.WithSecurityProfile, + DefinitionStages.WithCompletionPercent, + DefinitionStages.WithPublicNetworkAccess { + /** + * Executes the create request. + * + * @return the created resource. + */ + Disk create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Disk create(Context context); + } + /** The stage of the Disk 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 Disk definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + * UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS.. + * + * @param sku The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * @return the next definition stage. + */ + WithCreate withSku(DiskSku sku); + } + /** The stage of the Disk definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: The Logical zone list for Disk.. + * + * @param zones The Logical zone list for Disk. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + /** The stage of the Disk definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location where the disk will be created. Extended + * location cannot be changed.. + * + * @param extendedLocation The extended location where the disk will be created. Extended location cannot be + * changed. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the Disk definition allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: The Operating System type.. + * + * @param osType The Operating System type. + * @return the next definition stage. + */ + WithCreate withOsType(OperatingSystemTypes osType); + } + /** The stage of the Disk definition allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to + * OS disks only.. + * + * @param hyperVGeneration The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * @return the next definition stage. + */ + WithCreate withHyperVGeneration(HyperVGeneration hyperVGeneration); + } + /** The stage of the Disk definition allowing to specify purchasePlan. */ + interface WithPurchasePlan { + /** + * Specifies the purchasePlan property: Purchase plan information for the the image from which the OS disk + * was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * + * @param purchasePlan Purchase plan information for the the image from which the OS disk was created. E.g. + * - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. + * @return the next definition stage. + */ + WithCreate withPurchasePlan(PurchasePlanAutoGenerated purchasePlan); + } + /** The stage of the Disk definition allowing to specify supportedCapabilities. */ + interface WithSupportedCapabilities { + /** + * Specifies the supportedCapabilities property: List of supported capabilities for the image from which the + * OS disk was created.. + * + * @param supportedCapabilities List of supported capabilities for the image from which the OS disk was + * created. + * @return the next definition stage. + */ + WithCreate withSupportedCapabilities(SupportedCapabilities supportedCapabilities); + } + /** The stage of the Disk definition allowing to specify creationData. */ + interface WithCreationData { + /** + * Specifies the creationData property: Disk source information. CreationData information cannot be changed + * after the disk has been created.. + * + * @param creationData Disk source information. CreationData information cannot be changed after the disk + * has been created. + * @return the next definition stage. + */ + WithCreate withCreationData(CreationData creationData); + } + /** The stage of the Disk definition allowing to specify diskSizeGB. */ + interface WithDiskSizeGB { + /** + * Specifies the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for updates or creation with other + * options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + * can only increase the disk's size.. + * + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it + * indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + * @return the next definition stage. + */ + WithCreate withDiskSizeGB(Integer diskSizeGB); + } + /** The stage of the Disk definition allowing to specify encryptionSettingsCollection. */ + interface WithEncryptionSettingsCollection { + /** + * Specifies the encryptionSettingsCollection property: Encryption settings collection used for Azure Disk + * Encryption, can contain multiple encryption settings per disk or snapshot.. + * + * @param encryptionSettingsCollection Encryption settings collection used for Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * @return the next definition stage. + */ + WithCreate withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection); + } + /** The stage of the Disk definition allowing to specify diskIopsReadWrite. */ + interface WithDiskIopsReadWrite { + /** + * Specifies the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for + * UltraSSD disks. One operation can transfer between 4k and 256k bytes.. + * + * @param diskIopsReadWrite The number of IOPS allowed for this disk; only settable for UltraSSD disks. One + * operation can transfer between 4k and 256k bytes. + * @return the next definition stage. + */ + WithCreate withDiskIopsReadWrite(Long diskIopsReadWrite); + } + /** The stage of the Disk definition allowing to specify diskMBpsReadWrite. */ + interface WithDiskMBpsReadWrite { + /** + * Specifies the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD + * disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.. + * + * @param diskMBpsReadWrite The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * @return the next definition stage. + */ + WithCreate withDiskMBpsReadWrite(Long diskMBpsReadWrite); + } + /** The stage of the Disk definition allowing to specify diskIopsReadOnly. */ + interface WithDiskIopsReadOnly { + /** + * Specifies the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs + * mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.. + * + * @param diskIopsReadOnly The total number of IOPS that will be allowed across all VMs mounting the shared + * disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * @return the next definition stage. + */ + WithCreate withDiskIopsReadOnly(Long diskIopsReadOnly); + } + /** The stage of the Disk definition allowing to specify diskMBpsReadOnly. */ + interface WithDiskMBpsReadOnly { + /** + * Specifies the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs + * mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO + * notation, of powers of 10.. + * + * @param diskMBpsReadOnly The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of + * powers of 10. + * @return the next definition stage. + */ + WithCreate withDiskMBpsReadOnly(Long diskMBpsReadOnly); + } + /** The stage of the Disk definition allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys.. + * + * @param encryption Encryption property can be used to encrypt data at rest with customer managed keys or + * platform managed keys. + * @return the next definition stage. + */ + WithCreate withEncryption(Encryption encryption); + } + /** The stage of the Disk definition allowing to specify maxShares. */ + interface WithMaxShares { + /** + * Specifies 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 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 next definition stage. + */ + WithCreate withMaxShares(Integer maxShares); + } + /** The stage of the Disk definition allowing to specify networkAccessPolicy. */ + interface WithNetworkAccessPolicy { + /** + * Specifies the networkAccessPolicy property: Policy for accessing the disk via network.. + * + * @param networkAccessPolicy Policy for accessing the disk via network. + * @return the next definition stage. + */ + WithCreate withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy); + } + /** The stage of the Disk definition allowing to specify diskAccessId. */ + interface WithDiskAccessId { + /** + * Specifies the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on + * disks.. + * + * @param diskAccessId ARM id of the DiskAccess resource for using private endpoints on disks. + * @return the next definition stage. + */ + WithCreate withDiskAccessId(String diskAccessId); + } + /** The stage of the Disk definition allowing to specify tier. */ + interface WithTier { + /** + * Specifies the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks.. + * + * @param tier Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * @return the next definition stage. + */ + WithCreate withTier(String tier); + } + /** The stage of the Disk definition allowing to specify burstingEnabled. */ + interface WithBurstingEnabled { + /** + * Specifies the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance + * target of the disk. Bursting is disabled by default. Does not apply to Ultra disks.. + * + * @param burstingEnabled Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * @return the next definition stage. + */ + WithCreate withBurstingEnabled(Boolean burstingEnabled); + } + /** The stage of the Disk definition allowing to specify supportsHibernation. */ + interface WithSupportsHibernation { + /** + * Specifies the supportsHibernation property: Indicates the OS on a disk supports hibernation.. + * + * @param supportsHibernation Indicates the OS on a disk supports hibernation. + * @return the next definition stage. + */ + WithCreate withSupportsHibernation(Boolean supportsHibernation); + } + /** The stage of the Disk definition allowing to specify securityProfile. */ + interface WithSecurityProfile { + /** + * Specifies the securityProfile property: Contains the security related information for the resource.. + * + * @param securityProfile Contains the security related information for the resource. + * @return the next definition stage. + */ + WithCreate withSecurityProfile(DiskSecurityProfile securityProfile); + } + /** The stage of the Disk definition allowing to specify completionPercent. */ + interface WithCompletionPercent { + /** + * Specifies the completionPercent property: Percentage complete for the background copy when a resource is + * created via the CopyStart operation.. + * + * @param completionPercent Percentage complete for the background copy when a resource is created via the + * CopyStart operation. + * @return the next definition stage. + */ + WithCreate withCompletionPercent(Float completionPercent); + } + /** The stage of the Disk definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Policy for controlling export on the disk.. + * + * @param publicNetworkAccess Policy for controlling export on the disk. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + } + /** + * Begins update for the Disk resource. + * + * @return the stage of resource update. + */ + Disk.Update update(); + + /** The template for Disk update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithOsType, + UpdateStages.WithDiskSizeGB, + UpdateStages.WithEncryptionSettingsCollection, + UpdateStages.WithDiskIopsReadWrite, + UpdateStages.WithDiskMBpsReadWrite, + UpdateStages.WithDiskIopsReadOnly, + UpdateStages.WithDiskMBpsReadOnly, + UpdateStages.WithMaxShares, + UpdateStages.WithEncryption, + UpdateStages.WithNetworkAccessPolicy, + UpdateStages.WithDiskAccessId, + UpdateStages.WithTier, + UpdateStages.WithBurstingEnabled, + UpdateStages.WithPurchasePlan, + UpdateStages.WithSupportedCapabilities, + UpdateStages.WithSupportsHibernation, + UpdateStages.WithPublicNetworkAccess { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Disk apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Disk apply(Context context); + } + /** The Disk update stages. */ + interface UpdateStages { + /** The stage of the Disk 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 Disk update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + * UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS.. + * + * @param sku The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * @return the next definition stage. + */ + Update withSku(DiskSku sku); + } + /** The stage of the Disk update allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: the Operating System type.. + * + * @param osType the Operating System type. + * @return the next definition stage. + */ + Update withOsType(OperatingSystemTypes osType); + } + /** The stage of the Disk update allowing to specify diskSizeGB. */ + interface WithDiskSizeGB { + /** + * Specifies the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for updates or creation with other + * options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + * can only increase the disk's size.. + * + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it + * indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + * @return the next definition stage. + */ + Update withDiskSizeGB(Integer diskSizeGB); + } + /** The stage of the Disk update allowing to specify encryptionSettingsCollection. */ + interface WithEncryptionSettingsCollection { + /** + * Specifies the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk + * Encryption, can contain multiple encryption settings per disk or snapshot.. + * + * @param encryptionSettingsCollection Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * @return the next definition stage. + */ + Update withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection); + } + /** The stage of the Disk update allowing to specify diskIopsReadWrite. */ + interface WithDiskIopsReadWrite { + /** + * Specifies the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for + * UltraSSD disks. One operation can transfer between 4k and 256k bytes.. + * + * @param diskIopsReadWrite The number of IOPS allowed for this disk; only settable for UltraSSD disks. One + * operation can transfer between 4k and 256k bytes. + * @return the next definition stage. + */ + Update withDiskIopsReadWrite(Long diskIopsReadWrite); + } + /** The stage of the Disk update allowing to specify diskMBpsReadWrite. */ + interface WithDiskMBpsReadWrite { + /** + * Specifies the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD + * disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.. + * + * @param diskMBpsReadWrite The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * @return the next definition stage. + */ + Update withDiskMBpsReadWrite(Long diskMBpsReadWrite); + } + /** The stage of the Disk update allowing to specify diskIopsReadOnly. */ + interface WithDiskIopsReadOnly { + /** + * Specifies the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs + * mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.. + * + * @param diskIopsReadOnly The total number of IOPS that will be allowed across all VMs mounting the shared + * disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * @return the next definition stage. + */ + Update withDiskIopsReadOnly(Long diskIopsReadOnly); + } + /** The stage of the Disk update allowing to specify diskMBpsReadOnly. */ + interface WithDiskMBpsReadOnly { + /** + * Specifies the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs + * mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO + * notation, of powers of 10.. + * + * @param diskMBpsReadOnly The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of + * powers of 10. + * @return the next definition stage. + */ + Update withDiskMBpsReadOnly(Long diskMBpsReadOnly); + } + /** The stage of the Disk update allowing to specify maxShares. */ + interface WithMaxShares { + /** + * Specifies 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 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 next definition stage. + */ + Update withMaxShares(Integer maxShares); + } + /** The stage of the Disk update allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys.. + * + * @param encryption Encryption property can be used to encrypt data at rest with customer managed keys or + * platform managed keys. + * @return the next definition stage. + */ + Update withEncryption(Encryption encryption); + } + /** The stage of the Disk update allowing to specify networkAccessPolicy. */ + interface WithNetworkAccessPolicy { + /** + * Specifies the networkAccessPolicy property: Policy for accessing the disk via network.. + * + * @param networkAccessPolicy Policy for accessing the disk via network. + * @return the next definition stage. + */ + Update withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy); + } + /** The stage of the Disk update allowing to specify diskAccessId. */ + interface WithDiskAccessId { + /** + * Specifies the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on + * disks.. + * + * @param diskAccessId ARM id of the DiskAccess resource for using private endpoints on disks. + * @return the next definition stage. + */ + Update withDiskAccessId(String diskAccessId); + } + /** The stage of the Disk update allowing to specify tier. */ + interface WithTier { + /** + * Specifies the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks.. + * + * @param tier Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * @return the next definition stage. + */ + Update withTier(String tier); + } + /** The stage of the Disk update allowing to specify burstingEnabled. */ + interface WithBurstingEnabled { + /** + * Specifies the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance + * target of the disk. Bursting is disabled by default. Does not apply to Ultra disks.. + * + * @param burstingEnabled Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * @return the next definition stage. + */ + Update withBurstingEnabled(Boolean burstingEnabled); + } + /** The stage of the Disk update allowing to specify purchasePlan. */ + interface WithPurchasePlan { + /** + * Specifies the purchasePlan property: Purchase plan information to be added on the OS disk. + * + * @param purchasePlan Purchase plan information to be added on the OS disk. + * @return the next definition stage. + */ + Update withPurchasePlan(PurchasePlanAutoGenerated purchasePlan); + } + /** The stage of the Disk update allowing to specify supportedCapabilities. */ + interface WithSupportedCapabilities { + /** + * Specifies the supportedCapabilities property: List of supported capabilities (like accelerated + * networking) to be added on the OS disk.. + * + * @param supportedCapabilities List of supported capabilities (like accelerated networking) to be added on + * the OS disk. + * @return the next definition stage. + */ + Update withSupportedCapabilities(SupportedCapabilities supportedCapabilities); + } + /** The stage of the Disk update allowing to specify supportsHibernation. */ + interface WithSupportsHibernation { + /** + * Specifies the supportsHibernation property: Indicates the OS on a disk supports hibernation.. + * + * @param supportsHibernation Indicates the OS on a disk supports hibernation. + * @return the next definition stage. + */ + Update withSupportsHibernation(Boolean supportsHibernation); + } + /** The stage of the Disk update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Policy for controlling export on the disk.. + * + * @param publicNetworkAccess Policy for controlling export on the disk. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Disk refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Disk refresh(Context context); + + /** + * Grants access to a disk. + * + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(GrantAccessData grantAccessData); + + /** + * Grants access to a disk. + * + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a disk. + * + * @throws com.azure.core.management.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 revokeAccess(); + + /** + * Revokes access to a 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 revokeAccess(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccess.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccess.java new file mode 100644 index 0000000000000..51bafacf5b10b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccess.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DiskAccess. */ +public interface DiskAccess { + /** + * 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 extendedLocation property: The extended location where the disk access will be created. Extended + * location cannot be changed. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the privateEndpointConnections property: A readonly collection of private endpoint connections created on + * the disk. Currently only one endpoint connection is supported. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the provisioningState property: The disk access resource provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the timeCreated property: The time when the disk access was created. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner object. + * + * @return the inner object. + */ + DiskAccessInner innerModel(); + + /** The entirety of the DiskAccess definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DiskAccess definition stages. */ + interface DefinitionStages { + /** The first stage of the DiskAccess definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DiskAccess 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 DiskAccess definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DiskAccess 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.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiskAccess create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiskAccess create(Context context); + } + /** The stage of the DiskAccess 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 DiskAccess definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location where the disk access will be created. + * Extended location cannot be changed.. + * + * @param extendedLocation The extended location where the disk access will be created. Extended location + * cannot be changed. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + /** + * Begins update for the DiskAccess resource. + * + * @return the stage of resource update. + */ + DiskAccess.Update update(); + + /** The template for DiskAccess update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiskAccess apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiskAccess apply(Context context); + } + /** The DiskAccess update stages. */ + interface UpdateStages { + /** The stage of the DiskAccess 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. + */ + DiskAccess refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiskAccess refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessList.java new file mode 100644 index 0000000000000..fea45a2dfd0ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskAccessInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List disk access operation response. */ +@Fluent +public final class DiskAccessList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskAccessList.class); + + /* + * A list of disk access resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of disk access resources. Call ListNext() + * with this to fetch the next page of disk access resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of disk access resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of disk access resources. + * + * @param value the value value to set. + * @return the DiskAccessList object itself. + */ + public DiskAccessList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of disk access resources. Call ListNext() with this to + * fetch the next page of disk access resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of disk access resources. Call ListNext() with this to + * fetch the next page of disk access resources. + * + * @param nextLink the nextLink value to set. + * @return the DiskAccessList object itself. + */ + public DiskAccessList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DiskAccessList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessUpdate.java new file mode 100644 index 0000000000000..f79fd2d763215 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccessUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Used for updating a disk access resource. */ +@Fluent +public final class DiskAccessUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskAccessUpdate.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 DiskAccessUpdate object itself. + */ + public DiskAccessUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccesses.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccesses.java new file mode 100644 index 0000000000000..4a8aff5fd0266 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskAccesses.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.PrivateEndpointConnectionInner; + +/** Resource collection API of DiskAccesses. */ +public interface DiskAccesses { + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource. + */ + DiskAccess getByResourceGroup(String resourceGroupName, String diskAccessName); + + /** + * Gets information about a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String diskAccessName, Context context); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskAccessName); + + /** + * Deletes a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskAccessName, Context context); + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disk access resources under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disk access resources under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + PagedIterable list(); + + /** + * Lists all the disk access resources under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk access operation response. + */ + PagedIterable list(Context context); + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource. + */ + PrivateLinkResourceListResult getPrivateLinkResources(String resourceGroupName, String diskAccessName); + + /** + * Gets the private link resources possible under disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources possible under disk access resource along with {@link Response}. + */ + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String diskAccessName, Context context); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + PrivateEndpointConnection updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new + * private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection private endpoint connection object supplied in the body of the Put private + * endpoint connection operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + PrivateEndpointConnection updateAPrivateEndpointConnection( + String resourceGroupName, + String diskAccessName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource. + */ + PrivateEndpointConnection getAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName); + + /** + * Gets information about a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a private endpoint connection under a disk access resource along with {@link Response}. + */ + Response getAPrivateEndpointConnectionWithResponse( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteAPrivateEndpointConnection( + String resourceGroupName, String diskAccessName, String privateEndpointConnectionName, Context context); + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName); + + /** + * List information about private endpoint connections under a disk access resource. + * + * @param resourceGroupName The name of the resource group. + * @param diskAccessName The name of the disk access resource that is being created. The name can't be changed after + * the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum + * name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + PagedIterable listPrivateEndpointConnections( + String resourceGroupName, String diskAccessName, Context context); + + /** + * Gets information about a disk access resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response}. + */ + DiskAccess getById(String id); + + /** + * Gets information about a disk access resource. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk access resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a disk access resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 a disk access resource. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 DiskAccess resource. + * + * @param name resource name. + * @return the first stage of the new DiskAccess definition. + */ + DiskAccess.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOption.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOption.java new file mode 100644 index 0000000000000..bc18975a7bc71 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOption.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskCreateOption. */ +public final class DiskCreateOption extends ExpandableStringEnum { + /** Static value Empty for DiskCreateOption. */ + public static final DiskCreateOption EMPTY = fromString("Empty"); + + /** Static value Attach for DiskCreateOption. */ + public static final DiskCreateOption ATTACH = fromString("Attach"); + + /** Static value FromImage for DiskCreateOption. */ + public static final DiskCreateOption FROM_IMAGE = fromString("FromImage"); + + /** Static value Import for DiskCreateOption. */ + public static final DiskCreateOption IMPORT = fromString("Import"); + + /** Static value Copy for DiskCreateOption. */ + public static final DiskCreateOption COPY = fromString("Copy"); + + /** Static value Restore for DiskCreateOption. */ + public static final DiskCreateOption RESTORE = fromString("Restore"); + + /** Static value Upload for DiskCreateOption. */ + public static final DiskCreateOption UPLOAD = fromString("Upload"); + + /** Static value CopyStart for DiskCreateOption. */ + public static final DiskCreateOption COPY_START = fromString("CopyStart"); + + /** Static value ImportSecure for DiskCreateOption. */ + public static final DiskCreateOption IMPORT_SECURE = fromString("ImportSecure"); + + /** Static value UploadPreparedSecure for DiskCreateOption. */ + public static final DiskCreateOption UPLOAD_PREPARED_SECURE = fromString("UploadPreparedSecure"); + + /** + * Creates or finds a DiskCreateOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskCreateOption. + */ + @JsonCreator + public static DiskCreateOption fromString(String name) { + return fromString(name, DiskCreateOption.class); + } + + /** @return known DiskCreateOption values. */ + public static Collection values() { + return values(DiskCreateOption.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOptionTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOptionTypes.java new file mode 100644 index 0000000000000..e2e1d409004d5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskCreateOptionTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskCreateOptionTypes. */ +public final class DiskCreateOptionTypes extends ExpandableStringEnum { + /** Static value FromImage for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes FROM_IMAGE = fromString("FromImage"); + + /** Static value Empty for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes EMPTY = fromString("Empty"); + + /** Static value Attach for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes ATTACH = fromString("Attach"); + + /** + * Creates or finds a DiskCreateOptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskCreateOptionTypes. + */ + @JsonCreator + public static DiskCreateOptionTypes fromString(String name) { + return fromString(name, DiskCreateOptionTypes.class); + } + + /** @return known DiskCreateOptionTypes values. */ + public static Collection values() { + return values(DiskCreateOptionTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDeleteOptionTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDeleteOptionTypes.java new file mode 100644 index 0000000000000..5b4313fd26ea6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDeleteOptionTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskDeleteOptionTypes. */ +public final class DiskDeleteOptionTypes extends ExpandableStringEnum { + /** Static value Delete for DiskDeleteOptionTypes. */ + public static final DiskDeleteOptionTypes DELETE = fromString("Delete"); + + /** Static value Detach for DiskDeleteOptionTypes. */ + public static final DiskDeleteOptionTypes DETACH = fromString("Detach"); + + /** + * Creates or finds a DiskDeleteOptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskDeleteOptionTypes. + */ + @JsonCreator + public static DiskDeleteOptionTypes fromString(String name) { + return fromString(name, DiskDeleteOptionTypes.class); + } + + /** @return known DiskDeleteOptionTypes values. */ + public static Collection values() { + return values(DiskDeleteOptionTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDetachOptionTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDetachOptionTypes.java new file mode 100644 index 0000000000000..1ab4482559cac --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskDetachOptionTypes.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskDetachOptionTypes. */ +public final class DiskDetachOptionTypes extends ExpandableStringEnum { + /** Static value ForceDetach for DiskDetachOptionTypes. */ + public static final DiskDetachOptionTypes FORCE_DETACH = fromString("ForceDetach"); + + /** + * Creates or finds a DiskDetachOptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskDetachOptionTypes. + */ + @JsonCreator + public static DiskDetachOptionTypes fromString(String name) { + return fromString(name, DiskDetachOptionTypes.class); + } + + /** @return known DiskDetachOptionTypes values. */ + public static Collection values() { + return values(DiskDetachOptionTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSet.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSet.java new file mode 100644 index 0000000000000..ca13a0d6d5ff0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSet.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DiskEncryptionSet. */ +public interface DiskEncryptionSet { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The managed identity for the disk encryption set. It should be given permission on + * the key vault before it can be used to encrypt disks. + * + * @return the identity value. + */ + EncryptionSetIdentity identity(); + + /** + * Gets the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @return the encryptionType value. + */ + DiskEncryptionSetType encryptionType(); + + /** + * Gets the activeKey property: The key vault key which is currently used by this disk encryption set. + * + * @return the activeKey value. + */ + KeyForDiskEncryptionSet activeKey(); + + /** + * Gets the previousKeys property: A readonly collection of key vault keys previously used by this disk encryption + * set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. + * + * @return the previousKeys value. + */ + List previousKeys(); + + /** + * Gets the provisioningState property: The disk encryption set provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + Boolean rotationToLatestKeyVersionEnabled(); + + /** + * Gets the lastKeyRotationTimestamp property: The time when the active key of this disk encryption set was updated. + * + * @return the lastKeyRotationTimestamp value. + */ + OffsetDateTime lastKeyRotationTimestamp(); + + /** + * Gets the autoKeyRotationError property: The error that was encountered during auto-key rotation. If an error is + * present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. + * + * @return the autoKeyRotationError value. + */ + ApiError autoKeyRotationError(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner object. + * + * @return the inner object. + */ + DiskEncryptionSetInner innerModel(); + + /** The entirety of the DiskEncryptionSet definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DiskEncryptionSet definition stages. */ + interface DefinitionStages { + /** The first stage of the DiskEncryptionSet definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DiskEncryptionSet 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 DiskEncryptionSet definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DiskEncryptionSet definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithEncryptionType, + DefinitionStages.WithActiveKey, + DefinitionStages.WithRotationToLatestKeyVersionEnabled { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiskEncryptionSet create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiskEncryptionSet create(Context context); + } + /** The stage of the DiskEncryptionSet 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 DiskEncryptionSet definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed identity for the disk encryption set. It should be given + * permission on the key vault before it can be used to encrypt disks.. + * + * @param identity The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * @return the next definition stage. + */ + WithCreate withIdentity(EncryptionSetIdentity identity); + } + /** The stage of the DiskEncryptionSet definition allowing to specify encryptionType. */ + interface WithEncryptionType { + /** + * Specifies the encryptionType property: The type of key used to encrypt the data of the disk.. + * + * @param encryptionType The type of key used to encrypt the data of the disk. + * @return the next definition stage. + */ + WithCreate withEncryptionType(DiskEncryptionSetType encryptionType); + } + /** The stage of the DiskEncryptionSet definition allowing to specify activeKey. */ + interface WithActiveKey { + /** + * Specifies the activeKey property: The key vault key which is currently used by this disk encryption set.. + * + * @param activeKey The key vault key which is currently used by this disk encryption set. + * @return the next definition stage. + */ + WithCreate withActiveKey(KeyForDiskEncryptionSet activeKey); + } + /** The stage of the DiskEncryptionSet definition allowing to specify rotationToLatestKeyVersionEnabled. */ + interface WithRotationToLatestKeyVersionEnabled { + /** + * Specifies the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating + * of this disk encryption set to the latest key version.. + * + * @param rotationToLatestKeyVersionEnabled Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * @return the next definition stage. + */ + WithCreate withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled); + } + } + /** + * Begins update for the DiskEncryptionSet resource. + * + * @return the stage of resource update. + */ + DiskEncryptionSet.Update update(); + + /** The template for DiskEncryptionSet update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithEncryptionType, + UpdateStages.WithActiveKey, + UpdateStages.WithRotationToLatestKeyVersionEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiskEncryptionSet apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiskEncryptionSet apply(Context context); + } + /** The DiskEncryptionSet update stages. */ + interface UpdateStages { + /** The stage of the DiskEncryptionSet 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 DiskEncryptionSet update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed identity for the disk encryption set. It should be given + * permission on the key vault before it can be used to encrypt disks.. + * + * @param identity The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * @return the next definition stage. + */ + Update withIdentity(EncryptionSetIdentity identity); + } + /** The stage of the DiskEncryptionSet update allowing to specify encryptionType. */ + interface WithEncryptionType { + /** + * Specifies the encryptionType property: The type of key used to encrypt the data of the disk.. + * + * @param encryptionType The type of key used to encrypt the data of the disk. + * @return the next definition stage. + */ + Update withEncryptionType(DiskEncryptionSetType encryptionType); + } + /** The stage of the DiskEncryptionSet update allowing to specify activeKey. */ + interface WithActiveKey { + /** + * Specifies the activeKey property: Key Vault Key Url to be used for server side encryption of Managed + * Disks and Snapshots. + * + * @param activeKey Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. + * @return the next definition stage. + */ + Update withActiveKey(KeyForDiskEncryptionSet activeKey); + } + /** The stage of the DiskEncryptionSet update allowing to specify rotationToLatestKeyVersionEnabled. */ + interface WithRotationToLatestKeyVersionEnabled { + /** + * Specifies the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating + * of this disk encryption set to the latest key version.. + * + * @param rotationToLatestKeyVersionEnabled Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * @return the next definition stage. + */ + Update withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiskEncryptionSet refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiskEncryptionSet refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetIdentityType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetIdentityType.java new file mode 100644 index 0000000000000..de70e244629cb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetIdentityType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskEncryptionSetIdentityType. */ +public final class DiskEncryptionSetIdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for DiskEncryptionSetIdentityType. */ + public static final DiskEncryptionSetIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value None for DiskEncryptionSetIdentityType. */ + public static final DiskEncryptionSetIdentityType NONE = fromString("None"); + + /** + * Creates or finds a DiskEncryptionSetIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskEncryptionSetIdentityType. + */ + @JsonCreator + public static DiskEncryptionSetIdentityType fromString(String name) { + return fromString(name, DiskEncryptionSetIdentityType.class); + } + + /** @return known DiskEncryptionSetIdentityType values. */ + public static Collection values() { + return values(DiskEncryptionSetIdentityType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetList.java new file mode 100644 index 0000000000000..9f4c4b592bbe5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List disk encryption set operation response. */ +@Fluent +public final class DiskEncryptionSetList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetList.class); + + /* + * A list of disk encryption sets. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of disk encryption sets. Call ListNext() + * with this to fetch the next page of disk encryption sets. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of disk encryption sets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of disk encryption sets. + * + * @param value the value value to set. + * @return the DiskEncryptionSetList object itself. + */ + public DiskEncryptionSetList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to + * fetch the next page of disk encryption sets. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of disk encryption sets. Call ListNext() with this to + * fetch the next page of disk encryption sets. + * + * @param nextLink the nextLink value to set. + * @return the DiskEncryptionSetList object itself. + */ + public DiskEncryptionSetList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DiskEncryptionSetList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetParameters.java new file mode 100644 index 0000000000000..ce32d2df69a20 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetParameters.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. + * <br><br> NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer + * https://aka.ms/mdssewithcmkoverview for more details. + */ +@Fluent +public final class DiskEncryptionSetParameters extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetParameters.class); + + /** {@inheritDoc} */ + @Override + public DiskEncryptionSetParameters withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetType.java new file mode 100644 index 0000000000000..1fdc1c86b75fb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskEncryptionSetType. */ +public final class DiskEncryptionSetType extends ExpandableStringEnum { + /** Static value EncryptionAtRestWithCustomerKey for DiskEncryptionSetType. */ + public static final DiskEncryptionSetType ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = + fromString("EncryptionAtRestWithCustomerKey"); + + /** Static value EncryptionAtRestWithPlatformAndCustomerKeys for DiskEncryptionSetType. */ + public static final DiskEncryptionSetType ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = + fromString("EncryptionAtRestWithPlatformAndCustomerKeys"); + + /** Static value ConfidentialVmEncryptedWithCustomerKey for DiskEncryptionSetType. */ + public static final DiskEncryptionSetType CONFIDENTIAL_VM_ENCRYPTED_WITH_CUSTOMER_KEY = + fromString("ConfidentialVmEncryptedWithCustomerKey"); + + /** + * Creates or finds a DiskEncryptionSetType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskEncryptionSetType. + */ + @JsonCreator + public static DiskEncryptionSetType fromString(String name) { + return fromString(name, DiskEncryptionSetType.class); + } + + /** @return known DiskEncryptionSetType values. */ + public static Collection values() { + return values(DiskEncryptionSetType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetUpdate.java new file mode 100644 index 0000000000000..319bf8a521566 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSetUpdate.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskEncryptionSetUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** disk encryption set update resource. */ +@Fluent +public final class DiskEncryptionSetUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSetUpdate.class); + + /* + * disk encryption set resource update properties. + */ + @JsonProperty(value = "properties") + private DiskEncryptionSetUpdateProperties innerProperties; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The managed identity for the disk encryption set. It should be given + * permission on the key vault before it can be used to encrypt disks. + */ + @JsonProperty(value = "identity") + private EncryptionSetIdentity identity; + + /** + * Get the innerProperties property: disk encryption set resource update properties. + * + * @return the innerProperties value. + */ + private DiskEncryptionSetUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 DiskEncryptionSetUpdate object itself. + */ + public DiskEncryptionSetUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * + * @return the identity value. + */ + public EncryptionSetIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identity for the disk encryption set. It should be given permission on the + * key vault before it can be used to encrypt disks. + * + * @param identity the identity value to set. + * @return the DiskEncryptionSetUpdate object itself. + */ + public DiskEncryptionSetUpdate withIdentity(EncryptionSetIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @return the encryptionType value. + */ + public DiskEncryptionSetType encryptionType() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionType(); + } + + /** + * Set the encryptionType property: The type of key used to encrypt the data of the disk. + * + * @param encryptionType the encryptionType value to set. + * @return the DiskEncryptionSetUpdate object itself. + */ + public DiskEncryptionSetUpdate withEncryptionType(DiskEncryptionSetType encryptionType) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskEncryptionSetUpdateProperties(); + } + this.innerProperties().withEncryptionType(encryptionType); + return this; + } + + /** + * Get the activeKey property: Key Vault Key Url to be used for server side encryption of Managed Disks and + * Snapshots. + * + * @return the activeKey value. + */ + public KeyForDiskEncryptionSet activeKey() { + return this.innerProperties() == null ? null : this.innerProperties().activeKey(); + } + + /** + * Set the activeKey property: Key Vault Key Url to be used for server side encryption of Managed Disks and + * Snapshots. + * + * @param activeKey the activeKey value to set. + * @return the DiskEncryptionSetUpdate object itself. + */ + public DiskEncryptionSetUpdate withActiveKey(KeyForDiskEncryptionSet activeKey) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskEncryptionSetUpdateProperties(); + } + this.innerProperties().withActiveKey(activeKey); + return this; + } + + /** + * Get the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().rotationToLatestKeyVersionEnabled(); + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Set this flag to true to enable auto-updating of this disk + * encryption set to the latest key version. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the DiskEncryptionSetUpdate object itself. + */ + public DiskEncryptionSetUpdate withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskEncryptionSetUpdateProperties(); + } + this.innerProperties().withRotationToLatestKeyVersionEnabled(rotationToLatestKeyVersionEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSets.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSets.java new file mode 100644 index 0000000000000..0b2ce9191b1af --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSets.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 DiskEncryptionSets. */ +public interface DiskEncryptionSets { + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set. + */ + DiskEncryptionSet getByResourceGroup(String resourceGroupName, String diskEncryptionSetName); + + /** + * Gets information about a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String diskEncryptionSetName, Context context); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskEncryptionSetName); + + /** + * Deletes a disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 diskEncryptionSetName, Context context); + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disk encryption sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disk encryption sets under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + PagedIterable list(); + + /** + * Lists all the disk encryption sets under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List disk encryption set operation response. + */ + PagedIterable list(Context context); + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + PagedIterable listAssociatedResources(String resourceGroupName, String diskEncryptionSetName); + + /** + * Lists all resources that are encrypted with this disk encryption set. + * + * @param resourceGroupName The name of the resource group. + * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed + * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + * maximum name length is 80 characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List resources which are encrypted with the disk encryption set. + */ + PagedIterable listAssociatedResources( + String resourceGroupName, String diskEncryptionSetName, Context context); + + /** + * Gets information about a disk encryption set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response}. + */ + DiskEncryptionSet getById(String id); + + /** + * Gets information about a disk encryption set. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk encryption set along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a disk encryption set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 a disk encryption set. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 DiskEncryptionSet resource. + * + * @param name resource name. + * @return the first stage of the new DiskEncryptionSet definition. + */ + DiskEncryptionSet.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSettings.java new file mode 100644 index 0000000000000..634e348cd9b83 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskEncryptionSettings.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a Encryption Settings for a Disk. */ +@Fluent +public final class DiskEncryptionSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionSettings.class); + + /* + * Specifies the location of the disk encryption key, which is a Key Vault + * Secret. + */ + @JsonProperty(value = "diskEncryptionKey") + private KeyVaultSecretReference diskEncryptionKey; + + /* + * Specifies the location of the key encryption key in Key Vault. + */ + @JsonProperty(value = "keyEncryptionKey") + private KeyVaultKeyReference keyEncryptionKey; + + /* + * Specifies whether disk encryption should be enabled on the virtual + * machine. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get the diskEncryptionKey property: Specifies the location of the disk encryption key, which is a Key Vault + * Secret. + * + * @return the diskEncryptionKey value. + */ + public KeyVaultSecretReference diskEncryptionKey() { + return this.diskEncryptionKey; + } + + /** + * Set the diskEncryptionKey property: Specifies the location of the disk encryption key, which is a Key Vault + * Secret. + * + * @param diskEncryptionKey the diskEncryptionKey value to set. + * @return the DiskEncryptionSettings object itself. + */ + public DiskEncryptionSettings withDiskEncryptionKey(KeyVaultSecretReference diskEncryptionKey) { + this.diskEncryptionKey = diskEncryptionKey; + return this; + } + + /** + * Get the keyEncryptionKey property: Specifies the location of the key encryption key in Key Vault. + * + * @return the keyEncryptionKey value. + */ + public KeyVaultKeyReference keyEncryptionKey() { + return this.keyEncryptionKey; + } + + /** + * Set the keyEncryptionKey property: Specifies the location of the key encryption key in Key Vault. + * + * @param keyEncryptionKey the keyEncryptionKey value to set. + * @return the DiskEncryptionSettings object itself. + */ + public DiskEncryptionSettings withKeyEncryptionKey(KeyVaultKeyReference keyEncryptionKey) { + this.keyEncryptionKey = keyEncryptionKey; + return this; + } + + /** + * Get the enabled property: Specifies whether disk encryption should be enabled on the virtual machine. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Specifies whether disk encryption should be enabled on the virtual machine. + * + * @param enabled the enabled value to set. + * @return the DiskEncryptionSettings object itself. + */ + public DiskEncryptionSettings withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionKey() != null) { + diskEncryptionKey().validate(); + } + if (keyEncryptionKey() != null) { + keyEncryptionKey().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskImageEncryption.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskImageEncryption.java new file mode 100644 index 0000000000000..7a081ac33ae1c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskImageEncryption.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This is the disk image encryption base class. */ +@Fluent +public class DiskImageEncryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskImageEncryption.class); + + /* + * A relative URI containing the resource ID of the disk encryption set. + */ + @JsonProperty(value = "diskEncryptionSetId") + private String diskEncryptionSetId; + + /** + * Get the diskEncryptionSetId property: A relative URI containing the resource ID of the disk encryption set. + * + * @return the diskEncryptionSetId value. + */ + public String diskEncryptionSetId() { + return this.diskEncryptionSetId; + } + + /** + * Set the diskEncryptionSetId property: A relative URI containing the resource ID of the disk encryption set. + * + * @param diskEncryptionSetId the diskEncryptionSetId value to set. + * @return the DiskImageEncryption object itself. + */ + public DiskImageEncryption withDiskEncryptionSetId(String diskEncryptionSetId) { + this.diskEncryptionSetId = diskEncryptionSetId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskInstanceView.java new file mode 100644 index 0000000000000..f0fffb3611eab --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskInstanceView.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of the disk. */ +@Fluent +public final class DiskInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskInstanceView.class); + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the encryption settings for the OS Disk.

    Minimum + * api-version: 2015-06-15 + */ + @JsonProperty(value = "encryptionSettings") + private List encryptionSettings; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the DiskInstanceView object itself. + */ + public DiskInstanceView withName(String name) { + this.name = name; + return this; + } + + /** + * Get the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the encryptionSettings value. + */ + public List encryptionSettings() { + return this.encryptionSettings; + } + + /** + * Set the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> + * Minimum api-version: 2015-06-15. + * + * @param encryptionSettings the encryptionSettings value to set. + * @return the DiskInstanceView object itself. + */ + public DiskInstanceView withEncryptionSettings(List encryptionSettings) { + this.encryptionSettings = encryptionSettings; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the DiskInstanceView object itself. + */ + public DiskInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettings() != null) { + encryptionSettings().forEach(e -> e.validate()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskList.java new file mode 100644 index 0000000000000..424c5b9212d13 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskList.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Disks operation response. */ +@Fluent +public final class DiskList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskList.class); + + /* + * A list of disks. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of disks. Call ListNext() with this to + * fetch the next page of disks. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of disks. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of disks. + * + * @param value the value value to set. + * @return the DiskList object itself. + */ + public DiskList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next + * page of disks. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of disks. Call ListNext() with this to fetch the next + * page of disks. + * + * @param nextLink the nextLink value to set. + * @return the DiskList object itself. + */ + public DiskList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property value in model DiskList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoint.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoint.java new file mode 100644 index 0000000000000..823d5dfbd1691 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoint.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DiskRestorePoint. */ +public interface DiskRestorePoint { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the timeCreated property: The timestamp of restorePoint creation. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the sourceResourceId property: arm id of source disk or source disk restore point. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the osType property: The Operating System type. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the purchasePlan property: Purchase plan information for the the image from which the OS disk was created. + * + * @return the purchasePlan value. + */ + PurchasePlanAutoGenerated purchasePlan(); + + /** + * Gets the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @return the supportedCapabilities value. + */ + SupportedCapabilities supportedCapabilities(); + + /** + * Gets the familyId property: id of the backing snapshot's MIS family. + * + * @return the familyId value. + */ + String familyId(); + + /** + * Gets the sourceUniqueId property: unique incarnation id of the source disk. + * + * @return the sourceUniqueId value. + */ + String sourceUniqueId(); + + /** + * Gets the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + Encryption encryption(); + + /** + * Gets the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + Boolean supportsHibernation(); + + /** + * Gets the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + NetworkAccessPolicy networkAccessPolicy(); + + /** + * Gets the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + String diskAccessId(); + + /** + * Gets the completionPercent property: Percentage complete for the background copy of disk restore point when + * source resource is from a different region. + * + * @return the completionPercent value. + */ + Float completionPercent(); + + /** + * Gets the replicationState property: Replication state of disk restore point when source resource is from a + * different region. + * + * @return the replicationState value. + */ + String replicationState(); + + /** + * Gets the sourceResourceLocation property: Location of source disk or source disk restore point when source + * resource is from a different region. + * + * @return the sourceResourceLocation value. + */ + String sourceResourceLocation(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner object. + * + * @return the inner object. + */ + DiskRestorePointInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointInstanceView.java new file mode 100644 index 0000000000000..5e62436ef380c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointInstanceView.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The instance view of a disk restore point. */ +@Fluent +public final class DiskRestorePointInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskRestorePointInstanceView.class); + + /* + * Disk restore point Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The disk restore point replication status information. + */ + @JsonProperty(value = "replicationStatus") + private Object replicationStatus; + + /** + * Get the id property: Disk restore point Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Disk restore point Id. + * + * @param id the id value to set. + * @return the DiskRestorePointInstanceView object itself. + */ + public DiskRestorePointInstanceView withId(String id) { + this.id = id; + return this; + } + + /** + * Get the replicationStatus property: The disk restore point replication status information. + * + * @return the replicationStatus value. + */ + public Object replicationStatus() { + return this.replicationStatus; + } + + /** + * Set the replicationStatus property: The disk restore point replication status information. + * + * @param replicationStatus the replicationStatus value to set. + * @return the DiskRestorePointInstanceView object itself. + */ + public DiskRestorePointInstanceView withReplicationStatus(Object replicationStatus) { + this.replicationStatus = replicationStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointList.java new file mode 100644 index 0000000000000..6a2c3c939badd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePointList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskRestorePointInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Disk Restore Points operation response. */ +@Fluent +public final class DiskRestorePointList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskRestorePointList.class); + + /* + * A list of disk restore points. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of disk restore points. Call ListNext() + * with this to fetch the next page of disk restore points. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of disk restore points. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of disk restore points. + * + * @param value the value value to set. + * @return the DiskRestorePointList object itself. + */ + public DiskRestorePointList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of disk restore points. Call ListNext() with this to + * fetch the next page of disk restore points. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of disk restore points. Call ListNext() with this to + * fetch the next page of disk restore points. + * + * @param nextLink the nextLink value to set. + * @return the DiskRestorePointList object itself. + */ + public DiskRestorePointList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DiskRestorePointList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoints.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoints.java new file mode 100644 index 0000000000000..3570cb00cb780 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskRestorePoints.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 DiskRestorePoints. */ +public interface DiskRestorePoints { + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource. + */ + DiskRestorePoint get( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName); + + /** + * Get disk restorePoint resource. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk restorePoint resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context); + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName); + + /** + * Lists diskRestorePoints under a vmRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Disk Restore Points operation response. + */ + PagedIterable listByRestorePoint( + String resourceGroupName, String restorePointCollectionName, String vmRestorePointName, Context context); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData); + + /** + * Grants access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + GrantAccessData grantAccessData, + Context context); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName); + + /** + * Revokes access to a diskRestorePoint. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection that the disk restore point belongs. + * @param vmRestorePointName The name of the vm restore point that the disk disk restore point belongs. + * @param diskRestorePointName The name of the disk restore point created. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revokeAccess( + String resourceGroupName, + String restorePointCollectionName, + String vmRestorePointName, + String diskRestorePointName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityProfile.java new file mode 100644 index 0000000000000..261ebd39cba56 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityProfile.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the security related information for the resource. */ +@Fluent +public final class DiskSecurityProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskSecurityProfile.class); + + /* + * Specifies the SecurityType of the VM. Applicable for OS disks only. + */ + @JsonProperty(value = "securityType") + private DiskSecurityTypes securityType; + + /* + * ResourceId of the disk encryption set associated to Confidential VM + * supported disk encrypted with customer managed key + */ + @JsonProperty(value = "secureVMDiskEncryptionSetId") + private String secureVMDiskEncryptionSetId; + + /** + * Get the securityType property: Specifies the SecurityType of the VM. Applicable for OS disks only. + * + * @return the securityType value. + */ + public DiskSecurityTypes securityType() { + return this.securityType; + } + + /** + * Set the securityType property: Specifies the SecurityType of the VM. Applicable for OS disks only. + * + * @param securityType the securityType value to set. + * @return the DiskSecurityProfile object itself. + */ + public DiskSecurityProfile withSecurityType(DiskSecurityTypes securityType) { + this.securityType = securityType; + return this; + } + + /** + * Get the secureVMDiskEncryptionSetId property: ResourceId of the disk encryption set associated to Confidential VM + * supported disk encrypted with customer managed key. + * + * @return the secureVMDiskEncryptionSetId value. + */ + public String secureVMDiskEncryptionSetId() { + return this.secureVMDiskEncryptionSetId; + } + + /** + * Set the secureVMDiskEncryptionSetId property: ResourceId of the disk encryption set associated to Confidential VM + * supported disk encrypted with customer managed key. + * + * @param secureVMDiskEncryptionSetId the secureVMDiskEncryptionSetId value to set. + * @return the DiskSecurityProfile object itself. + */ + public DiskSecurityProfile withSecureVMDiskEncryptionSetId(String secureVMDiskEncryptionSetId) { + this.secureVMDiskEncryptionSetId = secureVMDiskEncryptionSetId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityTypes.java new file mode 100644 index 0000000000000..d966b8fb6bcdb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSecurityTypes.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskSecurityTypes. */ +public final class DiskSecurityTypes extends ExpandableStringEnum { + /** Static value TrustedLaunch for DiskSecurityTypes. */ + public static final DiskSecurityTypes TRUSTED_LAUNCH = fromString("TrustedLaunch"); + + /** Static value ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey for DiskSecurityTypes. */ + public static final DiskSecurityTypes CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY = + fromString("ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"); + + /** Static value ConfidentialVM_DiskEncryptedWithPlatformKey for DiskSecurityTypes. */ + public static final DiskSecurityTypes CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_PLATFORM_KEY = + fromString("ConfidentialVM_DiskEncryptedWithPlatformKey"); + + /** Static value ConfidentialVM_DiskEncryptedWithCustomerKey for DiskSecurityTypes. */ + public static final DiskSecurityTypes CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_CUSTOMER_KEY = + fromString("ConfidentialVM_DiskEncryptedWithCustomerKey"); + + /** + * Creates or finds a DiskSecurityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskSecurityTypes. + */ + @JsonCreator + public static DiskSecurityTypes fromString(String name) { + return fromString(name, DiskSecurityTypes.class); + } + + /** @return known DiskSecurityTypes values. */ + public static Collection values() { + return values(DiskSecurityTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSku.java new file mode 100644 index 0000000000000..28816762ba05c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskSku.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + */ +@Fluent +public final class DiskSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskSku.class); + + /* + * The sku name. + */ + @JsonProperty(value = "name") + private DiskStorageAccountTypes name; + + /* + * The sku tier. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /** + * Get the name property: The sku name. + * + * @return the name value. + */ + public DiskStorageAccountTypes name() { + return this.name; + } + + /** + * Set the name property: The sku name. + * + * @param name the name value to set. + * @return the DiskSku object itself. + */ + public DiskSku withName(DiskStorageAccountTypes name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskState.java new file mode 100644 index 0000000000000..cbe0f99c1e3ad --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskState.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskState. */ +public final class DiskState extends ExpandableStringEnum { + /** Static value Unattached for DiskState. */ + public static final DiskState UNATTACHED = fromString("Unattached"); + + /** Static value Attached for DiskState. */ + public static final DiskState ATTACHED = fromString("Attached"); + + /** Static value Reserved for DiskState. */ + public static final DiskState RESERVED = fromString("Reserved"); + + /** Static value Frozen for DiskState. */ + public static final DiskState FROZEN = fromString("Frozen"); + + /** Static value ActiveSAS for DiskState. */ + public static final DiskState ACTIVE_SAS = fromString("ActiveSAS"); + + /** Static value ActiveSASFrozen for DiskState. */ + public static final DiskState ACTIVE_SASFROZEN = fromString("ActiveSASFrozen"); + + /** Static value ReadyToUpload for DiskState. */ + public static final DiskState READY_TO_UPLOAD = fromString("ReadyToUpload"); + + /** Static value ActiveUpload for DiskState. */ + public static final DiskState ACTIVE_UPLOAD = fromString("ActiveUpload"); + + /** + * Creates or finds a DiskState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskState. + */ + @JsonCreator + public static DiskState fromString(String name) { + return fromString(name, DiskState.class); + } + + /** @return known DiskState values. */ + public static Collection values() { + return values(DiskState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskStorageAccountTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskStorageAccountTypes.java new file mode 100644 index 0000000000000..29e31b76d55f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskStorageAccountTypes.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskStorageAccountTypes. */ +public final class DiskStorageAccountTypes extends ExpandableStringEnum { + /** Static value Standard_LRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); + + /** Static value Premium_LRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); + + /** Static value StandardSSD_LRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes STANDARD_SSD_LRS = fromString("StandardSSD_LRS"); + + /** Static value UltraSSD_LRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes ULTRA_SSD_LRS = fromString("UltraSSD_LRS"); + + /** Static value Premium_ZRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes PREMIUM_ZRS = fromString("Premium_ZRS"); + + /** Static value StandardSSD_ZRS for DiskStorageAccountTypes. */ + public static final DiskStorageAccountTypes STANDARD_SSD_ZRS = fromString("StandardSSD_ZRS"); + + /** + * Creates or finds a DiskStorageAccountTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskStorageAccountTypes. + */ + @JsonCreator + public static DiskStorageAccountTypes fromString(String name) { + return fromString(name, DiskStorageAccountTypes.class); + } + + /** @return known DiskStorageAccountTypes values. */ + public static Collection values() { + return values(DiskStorageAccountTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskUpdate.java new file mode 100644 index 0000000000000..116d120a10630 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/DiskUpdate.java @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.DiskUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Disk update resource. */ +@Fluent +public final class DiskUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskUpdate.class); + + /* + * Disk resource update properties. + */ + @JsonProperty(value = "properties") + private DiskUpdateProperties innerProperties; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, + * UltraSSD_LRS, Premium_ZRS, or StandardSSD_ZRS. + */ + @JsonProperty(value = "sku") + private DiskSku sku; + + /** + * Get the innerProperties property: Disk resource update properties. + * + * @return the innerProperties value. + */ + private DiskUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 DiskUpdate object itself. + */ + public DiskUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * + * @return the sku value. + */ + public DiskSku sku() { + return this.sku; + } + + /** + * Set the sku property: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, + * Premium_ZRS, or StandardSSD_ZRS. + * + * @param sku the sku value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withSku(DiskSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the osType property: the Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: the Operating System type. + * + * @param osType the osType value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeGB(); + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskSizeGB(Integer diskSizeGB) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskSizeGB(diskSizeGB); + return this; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionSettingsCollection(); + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + + /** + * Get the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.innerProperties() == null ? null : this.innerProperties().diskIopsReadWrite(); + } + + /** + * Set the diskIopsReadWrite property: The number of IOPS allowed for this disk; only settable for UltraSSD disks. + * One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskIopsReadWrite(Long diskIopsReadWrite) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskIopsReadWrite(diskIopsReadWrite); + return this; + } + + /** + * Get the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.innerProperties() == null ? null : this.innerProperties().diskMBpsReadWrite(); + } + + /** + * Set the diskMBpsReadWrite property: The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps + * means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskMBpsReadWrite(diskMBpsReadWrite); + return this; + } + + /** + * Get the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @return the diskIopsReadOnly value. + */ + public Long diskIopsReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().diskIopsReadOnly(); + } + + /** + * Set the diskIopsReadOnly property: The total number of IOPS that will be allowed across all VMs mounting the + * shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + * + * @param diskIopsReadOnly the diskIopsReadOnly value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskIopsReadOnly(Long diskIopsReadOnly) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskIopsReadOnly(diskIopsReadOnly); + return this; + } + + /** + * Get the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @return the diskMBpsReadOnly value. + */ + public Long diskMBpsReadOnly() { + return this.innerProperties() == null ? null : this.innerProperties().diskMBpsReadOnly(); + } + + /** + * Set the diskMBpsReadOnly property: The total throughput (MBps) that will be allowed across all VMs mounting the + * shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of + * 10. + * + * @param diskMBpsReadOnly the diskMBpsReadOnly value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskMBpsReadOnly(Long diskMBpsReadOnly) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskMBpsReadOnly(diskMBpsReadOnly); + return this; + } + + /** + * 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 Integer maxShares() { + return this.innerProperties() == null ? null : this.innerProperties().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 DiskUpdate object itself. + */ + public DiskUpdate withMaxShares(Integer maxShares) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withMaxShares(maxShares); + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withEncryption(Encryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy(); + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.innerProperties() == null ? null : this.innerProperties().diskAccessId(); + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withDiskAccessId(String diskAccessId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withDiskAccessId(diskAccessId); + return this; + } + + /** + * Get the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @return the tier value. + */ + public String tier() { + return this.innerProperties() == null ? null : this.innerProperties().tier(); + } + + /** + * Set the tier property: Performance tier of the disk (e.g, P4, S10) as described here: + * https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + * + * @param tier the tier value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withTier(String tier) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withTier(tier); + return this; + } + + /** + * Get the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @return the burstingEnabled value. + */ + public Boolean burstingEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().burstingEnabled(); + } + + /** + * Set the burstingEnabled property: Set to true to enable bursting beyond the provisioned performance target of the + * disk. Bursting is disabled by default. Does not apply to Ultra disks. + * + * @param burstingEnabled the burstingEnabled value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withBurstingEnabled(Boolean burstingEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withBurstingEnabled(burstingEnabled); + return this; + } + + /** + * Get the purchasePlan property: Purchase plan information to be added on the OS disk. + * + * @return the purchasePlan value. + */ + public PurchasePlanAutoGenerated purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Purchase plan information to be added on the OS disk. + * + * @param purchasePlan the purchasePlan value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withPurchasePlan(PurchasePlanAutoGenerated purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) to be added + * on the OS disk. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities(); + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) to be added + * on the OS disk. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withSupportedCapabilities(supportedCapabilities); + return this; + } + + /** + * Get the propertyUpdatesInProgress property: Properties of the disk for which update is pending. + * + * @return the propertyUpdatesInProgress value. + */ + public PropertyUpdatesInProgress propertyUpdatesInProgress() { + return this.innerProperties() == null ? null : this.innerProperties().propertyUpdatesInProgress(); + } + + /** + * Get the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation(); + } + + /** + * Set the supportsHibernation property: Indicates the OS on a disk supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withSupportsHibernation(Boolean supportsHibernation) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withSupportsHibernation(supportsHibernation); + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the DiskUpdate object itself. + */ + public DiskUpdate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DiskUpdateProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disks.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disks.java new file mode 100644 index 0000000000000..3645a24510697 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Disks.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 Disks. */ +public interface Disks { + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + Disk getByResourceGroup(String resourceGroupName, String diskName); + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 diskName); + + /** + * Deletes a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 diskName, Context context); + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the disks under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Disks operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + PagedIterable list(); + + /** + * Lists all the disks under 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 the List Disks operation response. + */ + PagedIterable list(Context context); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData); + + /** + * Grants access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get disk access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String diskName); + + /** + * Revokes access to a disk. + * + * @param resourceGroupName The name of the resource group. + * @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is + * created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String diskName, Context context); + + /** + * Gets information about a 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 information about a disk along with {@link Response}. + */ + Disk getById(String id); + + /** + * Gets information about a 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 information about a disk along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a 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); + + /** + * Deletes a 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 Disk resource. + * + * @param name resource name. + * @return the first stage of the new Disk definition. + */ + Disk.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Encryption.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Encryption.java new file mode 100644 index 0000000000000..4f518d184371c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Encryption.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Encryption at rest settings for disk or snapshot. */ +@Fluent +public final class Encryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Encryption.class); + + /* + * ResourceId of the disk encryption set to use for enabling encryption at + * rest. + */ + @JsonProperty(value = "diskEncryptionSetId") + private String diskEncryptionSetId; + + /* + * The type of key used to encrypt the data of the disk. + */ + @JsonProperty(value = "type") + private EncryptionType type; + + /** + * Get the diskEncryptionSetId property: ResourceId of the disk encryption set to use for enabling encryption at + * rest. + * + * @return the diskEncryptionSetId value. + */ + public String diskEncryptionSetId() { + return this.diskEncryptionSetId; + } + + /** + * Set the diskEncryptionSetId property: ResourceId of the disk encryption set to use for enabling encryption at + * rest. + * + * @param diskEncryptionSetId the diskEncryptionSetId value to set. + * @return the Encryption object itself. + */ + public Encryption withDiskEncryptionSetId(String diskEncryptionSetId) { + this.diskEncryptionSetId = diskEncryptionSetId; + return this; + } + + /** + * Get the type property: The type of key used to encrypt the data of the disk. + * + * @return the type value. + */ + public EncryptionType type() { + return this.type; + } + + /** + * Set the type property: The type of key used to encrypt the data of the disk. + * + * @param type the type value to set. + * @return the Encryption object itself. + */ + public Encryption withType(EncryptionType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionImages.java new file mode 100644 index 0000000000000..961e545e69f92 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionImages.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + */ +@Fluent +public final class EncryptionImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionImages.class); + + /* + * Contains encryption settings for an OS disk image. + */ + @JsonProperty(value = "osDiskImage") + private OSDiskImageEncryption osDiskImage; + + /* + * A list of encryption specifications for data disk images. + */ + @JsonProperty(value = "dataDiskImages") + private List dataDiskImages; + + /** + * Get the osDiskImage property: Contains encryption settings for an OS disk image. + * + * @return the osDiskImage value. + */ + public OSDiskImageEncryption osDiskImage() { + return this.osDiskImage; + } + + /** + * Set the osDiskImage property: Contains encryption settings for an OS disk image. + * + * @param osDiskImage the osDiskImage value to set. + * @return the EncryptionImages object itself. + */ + public EncryptionImages withOsDiskImage(OSDiskImageEncryption osDiskImage) { + this.osDiskImage = osDiskImage; + return this; + } + + /** + * Get the dataDiskImages property: A list of encryption specifications for data disk images. + * + * @return the dataDiskImages value. + */ + public List dataDiskImages() { + return this.dataDiskImages; + } + + /** + * Set the dataDiskImages property: A list of encryption specifications for data disk images. + * + * @param dataDiskImages the dataDiskImages value to set. + * @return the EncryptionImages object itself. + */ + public EncryptionImages withDataDiskImages(List dataDiskImages) { + this.dataDiskImages = dataDiskImages; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osDiskImage() != null) { + osDiskImage().validate(); + } + if (dataDiskImages() != null) { + dataDiskImages().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSetIdentity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSetIdentity.java new file mode 100644 index 0000000000000..ee08fb3a2a412 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSetIdentity.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed identity for the disk encryption set. It should be given permission on the key vault before it can be + * used to encrypt disks. + */ +@Fluent +public class EncryptionSetIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionSetIdentity.class); + + /* + * The type of Managed Identity used by the DiskEncryptionSet. Only + * SystemAssigned is supported for new creations. Disk Encryption Sets can + * be updated with Identity type None during migration of subscription to a + * new Azure Active Directory tenant; it will cause the encrypted resources + * to lose access to the keys. + */ + @JsonProperty(value = "type") + private DiskEncryptionSetIdentityType type; + + /* + * The object id of the Managed Identity Resource. This will be sent to the + * RP from ARM via the x-ms-identity-principal-id header in the PUT request + * if the resource has a systemAssigned(implicit) identity + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of the Managed Identity Resource. This will be sent to the + * RP from ARM via the x-ms-client-tenant-id header in the PUT request if + * the resource has a systemAssigned(implicit) identity + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the type property: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + * supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of + * subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the + * keys. + * + * @return the type value. + */ + public DiskEncryptionSetIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is + * supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of + * subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the + * keys. + * + * @param type the type value to set. + * @return the EncryptionSetIdentity object itself. + */ + public EncryptionSetIdentity withType(DiskEncryptionSetIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The object id of the Managed Identity Resource. This will be sent to the RP from + * ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) + * identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM + * via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsCollection.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsCollection.java new file mode 100644 index 0000000000000..5e0d4481fe080 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsCollection.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Encryption settings for disk or snapshot. */ +@Fluent +public final class EncryptionSettingsCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionSettingsCollection.class); + + /* + * Set this flag to true and provide DiskEncryptionKey and optional + * KeyEncryptionKey to enable encryption. Set this flag to false and remove + * DiskEncryptionKey and KeyEncryptionKey to disable encryption. If + * EncryptionSettings is null in the request object, the existing settings + * remain unchanged. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * A collection of encryption settings, one for each disk volume. + */ + @JsonProperty(value = "encryptionSettings") + private List encryptionSettings; + + /* + * Describes what type of encryption is used for the disks. Once this field + * is set, it cannot be overwritten. '1.0' corresponds to Azure Disk + * Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. + */ + @JsonProperty(value = "encryptionSettingsVersion") + private String encryptionSettingsVersion; + + /** + * Get the enabled property: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to + * enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable + * encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to + * enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable + * encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. + * + * @param enabled the enabled value to set. + * @return the EncryptionSettingsCollection object itself. + */ + public EncryptionSettingsCollection withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the encryptionSettings property: A collection of encryption settings, one for each disk volume. + * + * @return the encryptionSettings value. + */ + public List encryptionSettings() { + return this.encryptionSettings; + } + + /** + * Set the encryptionSettings property: A collection of encryption settings, one for each disk volume. + * + * @param encryptionSettings the encryptionSettings value to set. + * @return the EncryptionSettingsCollection object itself. + */ + public EncryptionSettingsCollection withEncryptionSettings(List encryptionSettings) { + this.encryptionSettings = encryptionSettings; + return this; + } + + /** + * Get the encryptionSettingsVersion property: Describes what type of encryption is used for the disks. Once this + * field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + * to Azure Disk Encryption. + * + * @return the encryptionSettingsVersion value. + */ + public String encryptionSettingsVersion() { + return this.encryptionSettingsVersion; + } + + /** + * Set the encryptionSettingsVersion property: Describes what type of encryption is used for the disks. Once this + * field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds + * to Azure Disk Encryption. + * + * @param encryptionSettingsVersion the encryptionSettingsVersion value to set. + * @return the EncryptionSettingsCollection object itself. + */ + public EncryptionSettingsCollection withEncryptionSettingsVersion(String encryptionSettingsVersion) { + this.encryptionSettingsVersion = encryptionSettingsVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettings() != null) { + encryptionSettings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsElement.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsElement.java new file mode 100644 index 0000000000000..d397b42f9c738 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionSettingsElement.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Encryption settings for one disk volume. */ +@Fluent +public final class EncryptionSettingsElement { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionSettingsElement.class); + + /* + * Key Vault Secret Url and vault id of the disk encryption key + */ + @JsonProperty(value = "diskEncryptionKey") + private KeyVaultAndSecretReference diskEncryptionKey; + + /* + * Key Vault Key Url and vault id of the key encryption key. + * KeyEncryptionKey is optional and when provided is used to unwrap the + * disk encryption key. + */ + @JsonProperty(value = "keyEncryptionKey") + private KeyVaultAndKeyReference keyEncryptionKey; + + /** + * Get the diskEncryptionKey property: Key Vault Secret Url and vault id of the disk encryption key. + * + * @return the diskEncryptionKey value. + */ + public KeyVaultAndSecretReference diskEncryptionKey() { + return this.diskEncryptionKey; + } + + /** + * Set the diskEncryptionKey property: Key Vault Secret Url and vault id of the disk encryption key. + * + * @param diskEncryptionKey the diskEncryptionKey value to set. + * @return the EncryptionSettingsElement object itself. + */ + public EncryptionSettingsElement withDiskEncryptionKey(KeyVaultAndSecretReference diskEncryptionKey) { + this.diskEncryptionKey = diskEncryptionKey; + return this; + } + + /** + * Get the keyEncryptionKey property: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is + * optional and when provided is used to unwrap the disk encryption key. + * + * @return the keyEncryptionKey value. + */ + public KeyVaultAndKeyReference keyEncryptionKey() { + return this.keyEncryptionKey; + } + + /** + * Set the keyEncryptionKey property: Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is + * optional and when provided is used to unwrap the disk encryption key. + * + * @param keyEncryptionKey the keyEncryptionKey value to set. + * @return the EncryptionSettingsElement object itself. + */ + public EncryptionSettingsElement withKeyEncryptionKey(KeyVaultAndKeyReference keyEncryptionKey) { + this.keyEncryptionKey = keyEncryptionKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionKey() != null) { + diskEncryptionKey().validate(); + } + if (keyEncryptionKey() != null) { + keyEncryptionKey().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionType.java new file mode 100644 index 0000000000000..640fda2d66055 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/EncryptionType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EncryptionType. */ +public final class EncryptionType extends ExpandableStringEnum { + /** Static value EncryptionAtRestWithPlatformKey for EncryptionType. */ + public static final EncryptionType ENCRYPTION_AT_REST_WITH_PLATFORM_KEY = + fromString("EncryptionAtRestWithPlatformKey"); + + /** Static value EncryptionAtRestWithCustomerKey for EncryptionType. */ + public static final EncryptionType ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY = + fromString("EncryptionAtRestWithCustomerKey"); + + /** Static value EncryptionAtRestWithPlatformAndCustomerKeys for EncryptionType. */ + public static final EncryptionType ENCRYPTION_AT_REST_WITH_PLATFORM_AND_CUSTOMER_KEYS = + fromString("EncryptionAtRestWithPlatformAndCustomerKeys"); + + /** + * Creates or finds a EncryptionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EncryptionType. + */ + @JsonCreator + public static EncryptionType fromString(String name) { + return fromString(name, EncryptionType.class); + } + + /** @return known EncryptionType values. */ + public static Collection values() { + return values(EncryptionType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExecutionState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExecutionState.java new file mode 100644 index 0000000000000..e812eac0e7dcb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExecutionState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExecutionState. */ +public final class ExecutionState extends ExpandableStringEnum { + /** Static value Unknown for ExecutionState. */ + public static final ExecutionState UNKNOWN = fromString("Unknown"); + + /** Static value Pending for ExecutionState. */ + public static final ExecutionState PENDING = fromString("Pending"); + + /** Static value Running for ExecutionState. */ + public static final ExecutionState RUNNING = fromString("Running"); + + /** Static value Failed for ExecutionState. */ + public static final ExecutionState FAILED = fromString("Failed"); + + /** Static value Succeeded for ExecutionState. */ + public static final ExecutionState SUCCEEDED = fromString("Succeeded"); + + /** Static value TimedOut for ExecutionState. */ + public static final ExecutionState TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for ExecutionState. */ + public static final ExecutionState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ExecutionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionState. + */ + @JsonCreator + public static ExecutionState fromString(String name) { + return fromString(name, ExecutionState.class); + } + + /** @return known ExecutionState values. */ + public static Collection values() { + return values(ExecutionState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetCapacityReservationGroups.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetCapacityReservationGroups.java new file mode 100644 index 0000000000000..b4249daa15fd7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetCapacityReservationGroups.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExpandTypesForGetCapacityReservationGroups. */ +public final class ExpandTypesForGetCapacityReservationGroups + extends ExpandableStringEnum { + /** Static value virtualMachineScaleSetVMs/$ref for ExpandTypesForGetCapacityReservationGroups. */ + public static final ExpandTypesForGetCapacityReservationGroups VIRTUAL_MACHINE_SCALE_SET_VMS_REF = + fromString("virtualMachineScaleSetVMs/$ref"); + + /** Static value virtualMachines/$ref for ExpandTypesForGetCapacityReservationGroups. */ + public static final ExpandTypesForGetCapacityReservationGroups VIRTUAL_MACHINES_REF = + fromString("virtualMachines/$ref"); + + /** + * Creates or finds a ExpandTypesForGetCapacityReservationGroups from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExpandTypesForGetCapacityReservationGroups. + */ + @JsonCreator + public static ExpandTypesForGetCapacityReservationGroups fromString(String name) { + return fromString(name, ExpandTypesForGetCapacityReservationGroups.class); + } + + /** @return known ExpandTypesForGetCapacityReservationGroups values. */ + public static Collection values() { + return values(ExpandTypesForGetCapacityReservationGroups.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetVMScaleSets.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetVMScaleSets.java new file mode 100644 index 0000000000000..2e321bd086db8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExpandTypesForGetVMScaleSets.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExpandTypesForGetVMScaleSets. */ +public final class ExpandTypesForGetVMScaleSets extends ExpandableStringEnum { + /** Static value userData for ExpandTypesForGetVMScaleSets. */ + public static final ExpandTypesForGetVMScaleSets USER_DATA = fromString("userData"); + + /** + * Creates or finds a ExpandTypesForGetVMScaleSets from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExpandTypesForGetVMScaleSets. + */ + @JsonCreator + public static ExpandTypesForGetVMScaleSets fromString(String name) { + return fromString(name, ExpandTypesForGetVMScaleSets.class); + } + + /** @return known ExpandTypesForGetVMScaleSets values. */ + public static Collection values() { + return values(ExpandTypesForGetVMScaleSets.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocation.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocation.java new file mode 100644 index 0000000000000..2e2c785e68a7f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocation.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The complex type of the extended location. */ +@Fluent +public final class ExtendedLocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedLocation.class); + + /* + * The name of the extended location. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The type of the extended location. + */ + @JsonProperty(value = "type") + private ExtendedLocationTypes type; + + /** + * 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() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationType.java new file mode 100644 index 0000000000000..7a37fa4f277d2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExtendedLocationType. */ +public final class ExtendedLocationType extends ExpandableStringEnum { + /** Static value EdgeZone for ExtendedLocationType. */ + public static final ExtendedLocationType EDGE_ZONE = fromString("EdgeZone"); + + /** + * Creates or finds a ExtendedLocationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtendedLocationType. + */ + @JsonCreator + public static ExtendedLocationType fromString(String name) { + return fromString(name, ExtendedLocationType.class); + } + + /** @return known ExtendedLocationType values. */ + public static Collection values() { + return values(ExtendedLocationType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationTypes.java new file mode 100644 index 0000000000000..76db370afa463 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ExtendedLocationTypes.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExtendedLocationTypes. */ +public final class ExtendedLocationTypes extends ExpandableStringEnum { + /** Static value EdgeZone for ExtendedLocationTypes. */ + public static final ExtendedLocationTypes EDGE_ZONE = fromString("EdgeZone"); + + /** + * Creates or finds a ExtendedLocationTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtendedLocationTypes. + */ + @JsonCreator + public static ExtendedLocationTypes fromString(String name) { + return fromString(name, ExtendedLocationTypes.class); + } + + /** @return known ExtendedLocationTypes values. */ + public static Collection values() { + return values(ExtendedLocationTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Extension.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Extension.java new file mode 100644 index 0000000000000..861c60a7758a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Extension.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a cloud service Extension. */ +@Fluent +public final class Extension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Extension.class); + + /* + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Extension Properties. + */ + @JsonProperty(value = "properties") + private CloudServiceExtensionProperties properties; + + /** + * Get the name property: The name of the extension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the extension. + * + * @param name the name value to set. + * @return the Extension object itself. + */ + public Extension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Extension Properties. + * + * @return the properties value. + */ + public CloudServiceExtensionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Extension Properties. + * + * @param properties the properties value to set. + * @return the Extension object itself. + */ + public Extension withProperties(CloudServiceExtensionProperties 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(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Galleries.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Galleries.java new file mode 100644 index 0000000000000..1d523b10e5b14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Galleries.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 Galleries. */ +public interface Galleries { + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update. + */ + Gallery getByResourceGroup(String resourceGroupName, String galleryName); + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param select The select expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String galleryName, SelectPermissions select, Context context); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName); + + /** + * Delete a Shared Image Gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, Context context); + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List galleries under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List galleries under a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + PagedIterable list(); + + /** + * List galleries under a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Galleries operation response. + */ + PagedIterable list(Context context); + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response}. + */ + Gallery getById(String id); + + /** + * Retrieves information about a Shared Image Gallery. + * + * @param id the resource ID. + * @param select The select expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the Shared Image Gallery that you want to create or update along with {@link + * Response}. + */ + Response getByIdWithResponse(String id, SelectPermissions select, Context context); + + /** + * Delete a Shared Image Gallery. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Shared Image Gallery. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 Gallery resource. + * + * @param name resource name. + * @return the first stage of the new Gallery definition. + */ + Gallery.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Gallery.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Gallery.java new file mode 100644 index 0000000000000..f137a578d396a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Gallery.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner; +import java.util.Map; + +/** An immutable client-side representation of Gallery. */ +public interface Gallery { + /** + * 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 description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @return the description value. + */ + String description(); + + /** + * Gets the identifier property: Describes the gallery unique name. + * + * @return the identifier value. + */ + GalleryIdentifier identifier(); + + /** + * Gets the provisioningState property: The current state of the gallery. The provisioning state, which only appears + * in the response. + * + * @return the provisioningState value. + */ + GalleryPropertiesProvisioningState provisioningState(); + + /** + * Gets the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @return the sharingProfile value. + */ + SharingProfile sharingProfile(); + + /** + * Gets the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @return the softDeletePolicy value. + */ + SoftDeletePolicy softDeletePolicy(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner object. + * + * @return the inner object. + */ + GalleryInner innerModel(); + + /** The entirety of the Gallery definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Gallery definition stages. */ + interface DefinitionStages { + /** The first stage of the Gallery definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Gallery 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 Gallery definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Gallery 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.WithDescription, + DefinitionStages.WithIdentifier, + DefinitionStages.WithSharingProfile, + DefinitionStages.WithSoftDeletePolicy { + /** + * Executes the create request. + * + * @return the created resource. + */ + Gallery create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Gallery create(Context context); + } + /** The stage of the Gallery 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 Gallery definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this Shared Image Gallery resource. This property + * is updatable.. + * + * @param description The description of this Shared Image Gallery resource. This property is updatable. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Gallery definition allowing to specify identifier. */ + interface WithIdentifier { + /** + * Specifies the identifier property: Describes the gallery unique name.. + * + * @param identifier Describes the gallery unique name. + * @return the next definition stage. + */ + WithCreate withIdentifier(GalleryIdentifier identifier); + } + /** The stage of the Gallery definition allowing to specify sharingProfile. */ + interface WithSharingProfile { + /** + * Specifies the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @param sharingProfile Profile for gallery sharing to subscription or tenant. + * @return the next definition stage. + */ + WithCreate withSharingProfile(SharingProfile sharingProfile); + } + /** The stage of the Gallery definition allowing to specify softDeletePolicy. */ + interface WithSoftDeletePolicy { + /** + * Specifies the softDeletePolicy property: Contains information about the soft deletion policy of the + * gallery.. + * + * @param softDeletePolicy Contains information about the soft deletion policy of the gallery. + * @return the next definition stage. + */ + WithCreate withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy); + } + } + /** + * Begins update for the Gallery resource. + * + * @return the stage of resource update. + */ + Gallery.Update update(); + + /** The template for Gallery update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithIdentifier, + UpdateStages.WithSharingProfile, + UpdateStages.WithSoftDeletePolicy { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Gallery apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Gallery apply(Context context); + } + /** The Gallery update stages. */ + interface UpdateStages { + /** The stage of the Gallery 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 Gallery update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this Shared Image Gallery resource. This property + * is updatable.. + * + * @param description The description of this Shared Image Gallery resource. This property is updatable. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Gallery update allowing to specify identifier. */ + interface WithIdentifier { + /** + * Specifies the identifier property: Describes the gallery unique name.. + * + * @param identifier Describes the gallery unique name. + * @return the next definition stage. + */ + Update withIdentifier(GalleryIdentifier identifier); + } + /** The stage of the Gallery update allowing to specify sharingProfile. */ + interface WithSharingProfile { + /** + * Specifies the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @param sharingProfile Profile for gallery sharing to subscription or tenant. + * @return the next definition stage. + */ + Update withSharingProfile(SharingProfile sharingProfile); + } + /** The stage of the Gallery update allowing to specify softDeletePolicy. */ + interface WithSoftDeletePolicy { + /** + * Specifies the softDeletePolicy property: Contains information about the soft deletion policy of the + * gallery.. + * + * @param softDeletePolicy Contains information about the soft deletion policy of the gallery. + * @return the next definition stage. + */ + Update withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Gallery refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Gallery refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplication.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplication.java new file mode 100644 index 0000000000000..a19cc727c41b4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplication.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of GalleryApplication. */ +public interface GalleryApplication { + /** + * 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 description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @return the description value. + */ + String description(); + + /** + * Gets the eula property: The Eula agreement for the gallery Application Definition. + * + * @return the eula value. + */ + String eula(); + + /** + * Gets the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + String privacyStatementUri(); + + /** + * Gets the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + String releaseNoteUri(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the supportedOSType value. + */ + OperatingSystemTypes supportedOSType(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner object. + * + * @return the inner object. + */ + GalleryApplicationInner innerModel(); + + /** The entirety of the GalleryApplication definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The GalleryApplication definition stages. */ + interface DefinitionStages { + /** The first stage of the GalleryApplication definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GalleryApplication definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GalleryApplication definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, galleryName. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to + * be created. + * @return the next definition stage. + */ + WithCreate withExistingGallery(String resourceGroupName, String galleryName); + } + /** + * The stage of the GalleryApplication 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.WithDescription, + DefinitionStages.WithEula, + DefinitionStages.WithPrivacyStatementUri, + DefinitionStages.WithReleaseNoteUri, + DefinitionStages.WithEndOfLifeDate, + DefinitionStages.WithSupportedOSType { + /** + * Executes the create request. + * + * @return the created resource. + */ + GalleryApplication create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GalleryApplication create(Context context); + } + /** The stage of the GalleryApplication 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 GalleryApplication definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this gallery Application Definition resource. This + * property is updatable.. + * + * @param description The description of this gallery Application Definition resource. This property is + * updatable. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the GalleryApplication definition allowing to specify eula. */ + interface WithEula { + /** + * Specifies the eula property: The Eula agreement for the gallery Application Definition.. + * + * @param eula The Eula agreement for the gallery Application Definition. + * @return the next definition stage. + */ + WithCreate withEula(String eula); + } + /** The stage of the GalleryApplication definition allowing to specify privacyStatementUri. */ + interface WithPrivacyStatementUri { + /** + * Specifies the privacyStatementUri property: The privacy statement uri.. + * + * @param privacyStatementUri The privacy statement uri. + * @return the next definition stage. + */ + WithCreate withPrivacyStatementUri(String privacyStatementUri); + } + /** The stage of the GalleryApplication definition allowing to specify releaseNoteUri. */ + interface WithReleaseNoteUri { + /** + * Specifies the releaseNoteUri property: The release note uri.. + * + * @param releaseNoteUri The release note uri. + * @return the next definition stage. + */ + WithCreate withReleaseNoteUri(String releaseNoteUri); + } + /** The stage of the GalleryApplication definition allowing to specify endOfLifeDate. */ + interface WithEndOfLifeDate { + /** + * Specifies the endOfLifeDate property: The end of life date of the gallery Application Definition. This + * property can be used for decommissioning purposes. This property is updatable.. + * + * @param endOfLifeDate The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * @return the next definition stage. + */ + WithCreate withEndOfLifeDate(OffsetDateTime endOfLifeDate); + } + /** The stage of the GalleryApplication definition allowing to specify supportedOSType. */ + interface WithSupportedOSType { + /** + * Specifies the supportedOSType property: This property allows you to specify the supported type of the OS + * that application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param supportedOSType This property allows you to specify the supported type of the OS that application + * is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * @return the next definition stage. + */ + WithCreate withSupportedOSType(OperatingSystemTypes supportedOSType); + } + } + /** + * Begins update for the GalleryApplication resource. + * + * @return the stage of resource update. + */ + GalleryApplication.Update update(); + + /** The template for GalleryApplication update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithEula, + UpdateStages.WithPrivacyStatementUri, + UpdateStages.WithReleaseNoteUri, + UpdateStages.WithEndOfLifeDate, + UpdateStages.WithSupportedOSType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GalleryApplication apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GalleryApplication apply(Context context); + } + /** The GalleryApplication update stages. */ + interface UpdateStages { + /** The stage of the GalleryApplication 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 GalleryApplication update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this gallery Application Definition resource. This + * property is updatable.. + * + * @param description The description of this gallery Application Definition resource. This property is + * updatable. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the GalleryApplication update allowing to specify eula. */ + interface WithEula { + /** + * Specifies the eula property: The Eula agreement for the gallery Application Definition.. + * + * @param eula The Eula agreement for the gallery Application Definition. + * @return the next definition stage. + */ + Update withEula(String eula); + } + /** The stage of the GalleryApplication update allowing to specify privacyStatementUri. */ + interface WithPrivacyStatementUri { + /** + * Specifies the privacyStatementUri property: The privacy statement uri.. + * + * @param privacyStatementUri The privacy statement uri. + * @return the next definition stage. + */ + Update withPrivacyStatementUri(String privacyStatementUri); + } + /** The stage of the GalleryApplication update allowing to specify releaseNoteUri. */ + interface WithReleaseNoteUri { + /** + * Specifies the releaseNoteUri property: The release note uri.. + * + * @param releaseNoteUri The release note uri. + * @return the next definition stage. + */ + Update withReleaseNoteUri(String releaseNoteUri); + } + /** The stage of the GalleryApplication update allowing to specify endOfLifeDate. */ + interface WithEndOfLifeDate { + /** + * Specifies the endOfLifeDate property: The end of life date of the gallery Application Definition. This + * property can be used for decommissioning purposes. This property is updatable.. + * + * @param endOfLifeDate The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * @return the next definition stage. + */ + Update withEndOfLifeDate(OffsetDateTime endOfLifeDate); + } + /** The stage of the GalleryApplication update allowing to specify supportedOSType. */ + interface WithSupportedOSType { + /** + * Specifies the supportedOSType property: This property allows you to specify the supported type of the OS + * that application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param supportedOSType This property allows you to specify the supported type of the OS that application + * is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * @return the next definition stage. + */ + Update withSupportedOSType(OperatingSystemTypes supportedOSType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GalleryApplication refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GalleryApplication refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationList.java new file mode 100644 index 0000000000000..822911444c09a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationList.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Gallery Applications operation response. */ +@Fluent +public final class GalleryApplicationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationList.class); + + /* + * A list of Gallery Applications. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Application Definitions in the + * Application Gallery. Call ListNext() with this to fetch the next page of + * gallery Application Definitions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of Gallery Applications. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Gallery Applications. + * + * @param value the value value to set. + * @return the GalleryApplicationList object itself. + */ + public GalleryApplicationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Application Definitions in the Application Gallery. + * Call ListNext() with this to fetch the next page of gallery Application Definitions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Application Definitions in the Application Gallery. + * Call ListNext() with this to fetch the next page of gallery Application Definitions. + * + * @param nextLink the nextLink value to set. + * @return the GalleryApplicationList object itself. + */ + public GalleryApplicationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model GalleryApplicationList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationUpdate.java new file mode 100644 index 0000000000000..ba82834e3092f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationUpdate.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Specifies information about the gallery Application Definition that you want to update. */ +@Fluent +public final class GalleryApplicationUpdate extends UpdateResourceDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationUpdate.class); + + /* + * Describes the properties of a gallery Application Definition. + */ + @JsonProperty(value = "properties") + private GalleryApplicationProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery Application Definition. + * + * @return the innerProperties value. + */ + private GalleryApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this gallery Application Definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery Application Definition. + * + * @return the eula value. + */ + public String eula() { + return this.innerProperties() == null ? null : this.innerProperties().eula(); + } + + /** + * Set the eula property: The Eula agreement for the gallery Application Definition. + * + * @param eula the eula value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withEula(String eula) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withEula(eula); + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.innerProperties() == null ? null : this.innerProperties().privacyStatementUri(); + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withPrivacyStatementUri(String privacyStatementUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withPrivacyStatementUri(privacyStatementUri); + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.innerProperties() == null ? null : this.innerProperties().releaseNoteUri(); + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withReleaseNoteUri(String releaseNoteUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withReleaseNoteUri(releaseNoteUri); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery Application Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the supportedOSType value. + */ + public OperatingSystemTypes supportedOSType() { + return this.innerProperties() == null ? null : this.innerProperties().supportedOSType(); + } + + /** + * Set the supportedOSType property: This property allows you to specify the supported type of the OS that + * application is built for. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param supportedOSType the supportedOSType value to set. + * @return the GalleryApplicationUpdate object itself. + */ + public GalleryApplicationUpdate withSupportedOSType(OperatingSystemTypes supportedOSType) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationProperties(); + } + this.innerProperties().withSupportedOSType(supportedOSType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersion.java new file mode 100644 index 0000000000000..189d434cca61b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersion.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner; +import java.util.Map; + +/** An immutable client-side representation of GalleryApplicationVersion. */ +public interface GalleryApplicationVersion { + /** + * 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 publishingProfile property: The publishing profile of a gallery image version. + * + * @return the publishingProfile value. + */ + GalleryApplicationVersionPublishingProfile publishingProfile(); + + /** + * Gets the provisioningState property: The current state of the gallery Application Version. The provisioning + * state, which only appears in the response. + * + * @return the provisioningState value. + */ + GalleryApplicationVersionPropertiesProvisioningState provisioningState(); + + /** + * Gets the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + ReplicationStatus replicationStatus(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner object. + * + * @return the inner object. + */ + GalleryApplicationVersionInner innerModel(); + + /** The entirety of the GalleryApplicationVersion definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The GalleryApplicationVersion definition stages. */ + interface DefinitionStages { + /** The first stage of the GalleryApplicationVersion definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GalleryApplicationVersion definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GalleryApplicationVersion definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, galleryName, galleryApplicationName. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition + * resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application + * Version is to be created. + * @return the next definition stage. + */ + WithCreate withExistingApplication( + String resourceGroupName, String galleryName, String galleryApplicationName); + } + /** + * The stage of the GalleryApplicationVersion 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.WithPublishingProfile { + /** + * Executes the create request. + * + * @return the created resource. + */ + GalleryApplicationVersion create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GalleryApplicationVersion create(Context context); + } + /** The stage of the GalleryApplicationVersion 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 GalleryApplicationVersion definition allowing to specify publishingProfile. */ + interface WithPublishingProfile { + /** + * Specifies the publishingProfile property: The publishing profile of a gallery image version.. + * + * @param publishingProfile The publishing profile of a gallery image version. + * @return the next definition stage. + */ + WithCreate withPublishingProfile(GalleryApplicationVersionPublishingProfile publishingProfile); + } + } + /** + * Begins update for the GalleryApplicationVersion resource. + * + * @return the stage of resource update. + */ + GalleryApplicationVersion.Update update(); + + /** The template for GalleryApplicationVersion update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithPublishingProfile { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GalleryApplicationVersion apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GalleryApplicationVersion apply(Context context); + } + /** The GalleryApplicationVersion update stages. */ + interface UpdateStages { + /** The stage of the GalleryApplicationVersion 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 GalleryApplicationVersion update allowing to specify publishingProfile. */ + interface WithPublishingProfile { + /** + * Specifies the publishingProfile property: The publishing profile of a gallery image version.. + * + * @param publishingProfile The publishing profile of a gallery image version. + * @return the next definition stage. + */ + Update withPublishingProfile(GalleryApplicationVersionPublishingProfile publishingProfile); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GalleryApplicationVersion refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GalleryApplicationVersion refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionList.java new file mode 100644 index 0000000000000..2c4cfa4bd44f1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionList.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Gallery Application version operation response. */ +@Fluent +public final class GalleryApplicationVersionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionList.class); + + /* + * A list of gallery Application Versions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of gallery Application Versions. Call + * ListNext() with this to fetch the next page of gallery Application + * Versions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of gallery Application Versions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of gallery Application Versions. + * + * @param value the value value to set. + * @return the GalleryApplicationVersionList object itself. + */ + public GalleryApplicationVersionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of gallery Application Versions. Call ListNext() with + * this to fetch the next page of gallery Application Versions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of gallery Application Versions. Call ListNext() with + * this to fetch the next page of gallery Application Versions. + * + * @param nextLink the nextLink value to set. + * @return the GalleryApplicationVersionList object itself. + */ + public GalleryApplicationVersionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model GalleryApplicationVersionList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPropertiesProvisioningState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPropertiesProvisioningState.java new file mode 100644 index 0000000000000..02e999d119eaa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPropertiesProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GalleryApplicationVersionPropertiesProvisioningState. */ +public final class GalleryApplicationVersionPropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Failed for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Migrating for GalleryApplicationVersionPropertiesProvisioningState. */ + public static final GalleryApplicationVersionPropertiesProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a GalleryApplicationVersionPropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding GalleryApplicationVersionPropertiesProvisioningState. + */ + @JsonCreator + public static GalleryApplicationVersionPropertiesProvisioningState fromString(String name) { + return fromString(name, GalleryApplicationVersionPropertiesProvisioningState.class); + } + + /** @return known GalleryApplicationVersionPropertiesProvisioningState values. */ + public static Collection values() { + return values(GalleryApplicationVersionPropertiesProvisioningState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPublishingProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPublishingProfile.java new file mode 100644 index 0000000000000..387f2994a7580 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionPublishingProfile.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The publishing profile of a gallery image version. */ +@Fluent +public final class GalleryApplicationVersionPublishingProfile extends GalleryArtifactPublishingProfileBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionPublishingProfile.class); + + /* + * The source image from which the Image Version is going to be created. + */ + @JsonProperty(value = "source", required = true) + private UserArtifactSource source; + + /* + * The manageActions property. + */ + @JsonProperty(value = "manageActions") + private UserArtifactManage manageActions; + + /* + * Optional. Whether or not this application reports health. + */ + @JsonProperty(value = "enableHealthCheck") + private Boolean enableHealthCheck; + + /** + * Get the source property: The source image from which the Image Version is going to be created. + * + * @return the source value. + */ + public UserArtifactSource source() { + return this.source; + } + + /** + * Set the source property: The source image from which the Image Version is going to be created. + * + * @param source the source value to set. + * @return the GalleryApplicationVersionPublishingProfile object itself. + */ + public GalleryApplicationVersionPublishingProfile withSource(UserArtifactSource source) { + this.source = source; + return this; + } + + /** + * Get the manageActions property: The manageActions property. + * + * @return the manageActions value. + */ + public UserArtifactManage manageActions() { + return this.manageActions; + } + + /** + * Set the manageActions property: The manageActions property. + * + * @param manageActions the manageActions value to set. + * @return the GalleryApplicationVersionPublishingProfile object itself. + */ + public GalleryApplicationVersionPublishingProfile withManageActions(UserArtifactManage manageActions) { + this.manageActions = manageActions; + return this; + } + + /** + * Get the enableHealthCheck property: Optional. Whether or not this application reports health. + * + * @return the enableHealthCheck value. + */ + public Boolean enableHealthCheck() { + return this.enableHealthCheck; + } + + /** + * Set the enableHealthCheck property: Optional. Whether or not this application reports health. + * + * @param enableHealthCheck the enableHealthCheck value to set. + * @return the GalleryApplicationVersionPublishingProfile object itself. + */ + public GalleryApplicationVersionPublishingProfile withEnableHealthCheck(Boolean enableHealthCheck) { + this.enableHealthCheck = enableHealthCheck; + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withTargetRegions(List targetRegions) { + super.withTargetRegions(targetRegions); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withReplicaCount(Integer replicaCount) { + super.withReplicaCount(replicaCount); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withExcludeFromLatest(Boolean excludeFromLatest) { + super.withExcludeFromLatest(excludeFromLatest); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + super.withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withStorageAccountType(StorageAccountType storageAccountType) { + super.withStorageAccountType(storageAccountType); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionPublishingProfile withReplicationMode(ReplicationMode replicationMode) { + super.withReplicationMode(replicationMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (source() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property source in model GalleryApplicationVersionPublishingProfile")); + } else { + source().validate(); + } + if (manageActions() != null) { + manageActions().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionUpdate.java new file mode 100644 index 0000000000000..c656a1b6d0ab3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersionUpdate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryApplicationVersionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the gallery Application Version that you want to update. */ +@Fluent +public final class GalleryApplicationVersionUpdate extends UpdateResourceDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryApplicationVersionUpdate.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private GalleryApplicationVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private GalleryApplicationVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryApplicationVersionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publishingProfile property: The publishing profile of a gallery image version. + * + * @return the publishingProfile value. + */ + public GalleryApplicationVersionPublishingProfile publishingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().publishingProfile(); + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryApplicationVersionUpdate object itself. + */ + public GalleryApplicationVersionUpdate withPublishingProfile( + GalleryApplicationVersionPublishingProfile publishingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryApplicationVersionProperties(); + } + this.innerProperties().withPublishingProfile(publishingProfile); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery Application Version. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryApplicationVersionPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().replicationStatus(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersions.java new file mode 100644 index 0000000000000..8e8c9d4c5a9f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplicationVersions.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 GalleryApplicationVersions. */ +public interface GalleryApplicationVersions { + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update. + */ + GalleryApplicationVersion get( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName); + + /** + * Retrieves information about a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + ReplicationStatusTypes expand, + Context context); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName); + + /** + * Delete a gallery Application Version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the gallery Application Definition in which the Application Version + * resides. + * @param galleryApplicationVersionName The name of the gallery Application Version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryApplicationName, + String galleryApplicationVersionName, + Context context); + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName); + + /** + * List gallery Application Versions in a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition resides. + * @param galleryApplicationName The name of the Shared Application Gallery Application Definition from which the + * Application Versions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Application version operation response. + */ + PagedIterable listByGalleryApplication( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context); + + /** + * Retrieves information about a gallery Application Version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response}. + */ + GalleryApplicationVersion getById(String id); + + /** + * Retrieves information about a gallery Application Version. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Version that you want to create or update along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, ReplicationStatusTypes expand, Context context); + + /** + * Delete a gallery Application Version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a gallery Application Version. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 GalleryApplicationVersion resource. + * + * @param name resource name. + * @return the first stage of the new GalleryApplicationVersion definition. + */ + GalleryApplicationVersion.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplications.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplications.java new file mode 100644 index 0000000000000..bb51558f6eb1f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryApplications.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 GalleryApplications. */ +public interface GalleryApplications { + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update. + */ + GalleryApplication get(String resourceGroupName, String galleryName, String galleryApplicationName); + + /** + * Retrieves information about a gallery Application Definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which the Application Definitions are to be + * retrieved. + * @param galleryApplicationName The name of the gallery Application Definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String galleryName, String galleryApplicationName, Context context); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryApplicationName); + + /** + * Delete a gallery Application. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery in which the Application Definition is to be + * deleted. + * @param galleryApplicationName The name of the gallery Application Definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryApplicationName, Context context); + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + PagedIterable listByGallery(String resourceGroupName, String galleryName); + + /** + * List gallery Application Definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Application Gallery from which Application Definitions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Applications operation response. + */ + PagedIterable listByGallery(String resourceGroupName, String galleryName, Context context); + + /** + * Retrieves information about a gallery Application Definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response}. + */ + GalleryApplication getById(String id); + + /** + * Retrieves information about a gallery Application Definition. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery Application Definition that you want to create or update along + * with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a gallery Application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a gallery Application. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 GalleryApplication resource. + * + * @param name resource name. + * @return the first stage of the new GalleryApplication definition. + */ + GalleryApplication.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactPublishingProfileBase.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactPublishingProfileBase.java new file mode 100644 index 0000000000000..167234eaff77b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactPublishingProfileBase.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the basic gallery artifact publishing profile. */ +@Fluent +public class GalleryArtifactPublishingProfileBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryArtifactPublishingProfileBase.class); + + /* + * The target regions where the Image Version is going to be replicated to. + * This property is updatable. + */ + @JsonProperty(value = "targetRegions") + private List targetRegions; + + /* + * The number of replicas of the Image Version to be created per region. + * This property would take effect for a region when regionalReplicaCount + * is not specified. This property is updatable. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /* + * If set to true, Virtual Machines deployed from the latest version of the + * Image Definition won't use this Image Version. + */ + @JsonProperty(value = "excludeFromLatest") + private Boolean excludeFromLatest; + + /* + * The timestamp for when the gallery image version is published. + */ + @JsonProperty(value = "publishedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime publishedDate; + + /* + * The end of life date of the gallery image version. This property can be + * used for decommissioning purposes. This property is updatable. + */ + @JsonProperty(value = "endOfLifeDate") + private OffsetDateTime endOfLifeDate; + + /* + * Specifies the storage account type to be used to store the image. This + * property is not updatable. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountType storageAccountType; + + /* + * Optional parameter which specifies the mode to be used for replication. + * This property is not updatable. + */ + @JsonProperty(value = "replicationMode") + private ReplicationMode replicationMode; + + /** + * Get the targetRegions property: The target regions where the Image Version is going to be replicated to. This + * property is updatable. + * + * @return the targetRegions value. + */ + public List targetRegions() { + return this.targetRegions; + } + + /** + * Set the targetRegions property: The target regions where the Image Version is going to be replicated to. This + * property is updatable. + * + * @param targetRegions the targetRegions value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withTargetRegions(List targetRegions) { + this.targetRegions = targetRegions; + return this; + } + + /** + * Get the replicaCount property: The number of replicas of the Image Version to be created per region. This + * property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the replicaCount property: The number of replicas of the Image Version to be created per region. This + * property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. + * + * @param replicaCount the replicaCount value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the excludeFromLatest property: If set to true, Virtual Machines deployed from the latest version of the + * Image Definition won't use this Image Version. + * + * @return the excludeFromLatest value. + */ + public Boolean excludeFromLatest() { + return this.excludeFromLatest; + } + + /** + * Set the excludeFromLatest property: If set to true, Virtual Machines deployed from the latest version of the + * Image Definition won't use this Image Version. + * + * @param excludeFromLatest the excludeFromLatest value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withExcludeFromLatest(Boolean excludeFromLatest) { + this.excludeFromLatest = excludeFromLatest; + return this; + } + + /** + * Get the publishedDate property: The timestamp for when the gallery image version is published. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.publishedDate; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image version. This property can be used for + * decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.endOfLifeDate; + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image version. This property can be used for + * decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + this.endOfLifeDate = endOfLifeDate; + return this; + } + + /** + * Get the storageAccountType property: Specifies the storage account type to be used to store the image. This + * property is not updatable. + * + * @return the storageAccountType value. + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type to be used to store the image. This + * property is not updatable. + * + * @param storageAccountType the storageAccountType value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the replicationMode property: Optional parameter which specifies the mode to be used for replication. This + * property is not updatable. + * + * @return the replicationMode value. + */ + public ReplicationMode replicationMode() { + return this.replicationMode; + } + + /** + * Set the replicationMode property: Optional parameter which specifies the mode to be used for replication. This + * property is not updatable. + * + * @param replicationMode the replicationMode value to set. + * @return the GalleryArtifactPublishingProfileBase object itself. + */ + public GalleryArtifactPublishingProfileBase withReplicationMode(ReplicationMode replicationMode) { + this.replicationMode = replicationMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetRegions() != null) { + targetRegions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactVersionSource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactVersionSource.java new file mode 100644 index 0000000000000..2c5b815ffd23b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryArtifactVersionSource.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The gallery artifact version source. */ +@Fluent +public final class GalleryArtifactVersionSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryArtifactVersionSource.class); + + /* + * The id of the gallery artifact version source. Can specify a disk uri, + * snapshot uri, user image or storage account resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The uri of the gallery artifact version source. Currently used to + * specify vhd/blob source. + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the id property: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user + * image or storage account resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user + * image or storage account resource. + * + * @param id the id value to set. + * @return the GalleryArtifactVersionSource object itself. + */ + public GalleryArtifactVersionSource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the uri property: The uri of the gallery artifact version source. Currently used to specify vhd/blob source. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The uri of the gallery artifact version source. Currently used to specify vhd/blob source. + * + * @param uri the uri value to set. + * @return the GalleryArtifactVersionSource object itself. + */ + public GalleryArtifactVersionSource withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDataDiskImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDataDiskImage.java new file mode 100644 index 0000000000000..517d92729a782 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDataDiskImage.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This is the data disk image. */ +@Fluent +public final class GalleryDataDiskImage extends GalleryDiskImage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryDataDiskImage.class); + + /* + * This property specifies the logical unit number of the data disk. This + * value is used to identify data disks within the Virtual Machine and + * therefore must be unique for each data disk attached to the Virtual + * Machine. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /** + * Get the lun property: This property specifies the logical unit number of the data disk. This value is used to + * identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the + * Virtual Machine. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: This property specifies the logical unit number of the data disk. This value is used to + * identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the + * Virtual Machine. + * + * @param lun the lun value to set. + * @return the GalleryDataDiskImage object itself. + */ + public GalleryDataDiskImage withLun(int lun) { + this.lun = lun; + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryDataDiskImage withHostCaching(HostCaching hostCaching) { + super.withHostCaching(hostCaching); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryDataDiskImage withSource(GalleryArtifactVersionSource source) { + super.withSource(source); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDiskImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDiskImage.java new file mode 100644 index 0000000000000..145d1f36de2a8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryDiskImage.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This is the disk image base class. */ +@Fluent +public class GalleryDiskImage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryDiskImage.class); + + /* + * This property indicates the size of the VHD to be created. + */ + @JsonProperty(value = "sizeInGB", access = JsonProperty.Access.WRITE_ONLY) + private Integer sizeInGB; + + /* + * The host caching of the disk. Valid values are 'None', 'ReadOnly', and + * 'ReadWrite' + */ + @JsonProperty(value = "hostCaching") + private HostCaching hostCaching; + + /* + * The gallery artifact version source. + */ + @JsonProperty(value = "source") + private GalleryArtifactVersionSource source; + + /** + * Get the sizeInGB property: This property indicates the size of the VHD to be created. + * + * @return the sizeInGB value. + */ + public Integer sizeInGB() { + return this.sizeInGB; + } + + /** + * Get the hostCaching property: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. + * + * @return the hostCaching value. + */ + public HostCaching hostCaching() { + return this.hostCaching; + } + + /** + * Set the hostCaching property: The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. + * + * @param hostCaching the hostCaching value to set. + * @return the GalleryDiskImage object itself. + */ + public GalleryDiskImage withHostCaching(HostCaching hostCaching) { + this.hostCaching = hostCaching; + return this; + } + + /** + * Get the source property: The gallery artifact version source. + * + * @return the source value. + */ + public GalleryArtifactVersionSource source() { + return this.source; + } + + /** + * Set the source property: The gallery artifact version source. + * + * @param source the source value to set. + * @return the GalleryDiskImage object itself. + */ + public GalleryDiskImage withSource(GalleryArtifactVersionSource source) { + this.source = source; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryIdentifier.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryIdentifier.java new file mode 100644 index 0000000000000..fd10a448b11e6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryIdentifier.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the gallery unique name. */ +@Immutable +public final class GalleryIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryIdentifier.class); + + /* + * The unique name of the Shared Image Gallery. This name is generated + * automatically by Azure. + */ + @JsonProperty(value = "uniqueName", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueName; + + /** + * Get the uniqueName property: The unique name of the Shared Image Gallery. This name is generated automatically by + * Azure. + * + * @return the uniqueName value. + */ + public String uniqueName() { + return this.uniqueName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImage.java new file mode 100644 index 0000000000000..a46446ebba47e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImage.java @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner; +import java.time.OffsetDateTime; +import java.util.List; +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 description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @return the description value. + */ + String description(); + + /** + * Gets the eula property: The Eula agreement for the gallery image definition. + * + * @return the eula value. + */ + String eula(); + + /** + * Gets the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + String privacyStatementUri(); + + /** + * Gets the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + String releaseNoteUri(); + + /** + * Gets the osType property: This property allows you to specify the type of the OS that is included in the disk + * when creating a VM from a managed image. <br><br> Possible values are: <br><br> + * **Windows** <br><br> **Linux**. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + OperatingSystemStateTypes osState(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + GalleryImageIdentifier identifier(); + + /** + * Gets the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + RecommendedMachineConfiguration recommended(); + + /** + * Gets the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + Disallowed disallowed(); + + /** + * Gets the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + ImagePurchasePlan purchasePlan(); + + /** + * Gets the provisioningState property: The current state of the gallery image definition. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + GalleryImagePropertiesProvisioningState provisioningState(); + + /** + * Gets the features property: A list of gallery image features. + * + * @return the features value. + */ + List features(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner object. + * + * @return the inner object. + */ + GalleryImageInner innerModel(); + + /** The entirety of the GalleryImage definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GalleryImage definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, galleryName. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be created. + * @return the next definition stage. + */ + WithCreate withExistingGallery(String resourceGroupName, String galleryName); + } + /** + * 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.WithDescription, + DefinitionStages.WithEula, + DefinitionStages.WithPrivacyStatementUri, + DefinitionStages.WithReleaseNoteUri, + DefinitionStages.WithOsType, + DefinitionStages.WithOsState, + DefinitionStages.WithHyperVGeneration, + DefinitionStages.WithEndOfLifeDate, + DefinitionStages.WithIdentifier, + DefinitionStages.WithRecommended, + DefinitionStages.WithDisallowed, + DefinitionStages.WithPurchasePlan, + DefinitionStages.WithFeatures { + /** + * 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 description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this gallery image definition resource. This + * property is updatable.. + * + * @param description The description of this gallery image definition resource. This property is updatable. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the GalleryImage definition allowing to specify eula. */ + interface WithEula { + /** + * Specifies the eula property: The Eula agreement for the gallery image definition.. + * + * @param eula The Eula agreement for the gallery image definition. + * @return the next definition stage. + */ + WithCreate withEula(String eula); + } + /** The stage of the GalleryImage definition allowing to specify privacyStatementUri. */ + interface WithPrivacyStatementUri { + /** + * Specifies the privacyStatementUri property: The privacy statement uri.. + * + * @param privacyStatementUri The privacy statement uri. + * @return the next definition stage. + */ + WithCreate withPrivacyStatementUri(String privacyStatementUri); + } + /** The stage of the GalleryImage definition allowing to specify releaseNoteUri. */ + interface WithReleaseNoteUri { + /** + * Specifies the releaseNoteUri property: The release note uri.. + * + * @param releaseNoteUri The release note uri. + * @return the next definition stage. + */ + WithCreate withReleaseNoteUri(String releaseNoteUri); + } + /** The stage of the GalleryImage definition allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: This property allows you to specify the type of the OS that is included in + * the disk when creating a VM from a managed image. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **Linux**. + * + * @param osType This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> + * **Windows** <br><br> **Linux**. + * @return the next definition stage. + */ + WithCreate withOsType(OperatingSystemTypes osType); + } + /** The stage of the GalleryImage definition allowing to specify osState. */ + interface WithOsState { + /** + * Specifies the osState property: This property allows the user to specify whether the virtual machines + * created under this image are 'Generalized' or 'Specialized'.. + * + * @param osState This property allows the user to specify whether the virtual machines created under this + * image are 'Generalized' or 'Specialized'. + * @return the next definition stage. + */ + WithCreate withOsState(OperatingSystemStateTypes osState); + } + /** The stage of the GalleryImage definition allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to + * OS disks only.. + * + * @param hyperVGeneration The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * @return the next definition stage. + */ + WithCreate withHyperVGeneration(HyperVGeneration hyperVGeneration); + } + /** The stage of the GalleryImage definition allowing to specify endOfLifeDate. */ + interface WithEndOfLifeDate { + /** + * Specifies the endOfLifeDate property: The end of life date of the gallery image definition. This property + * can be used for decommissioning purposes. This property is updatable.. + * + * @param endOfLifeDate The end of life date of the gallery image definition. This property can be used for + * decommissioning purposes. This property is updatable. + * @return the next definition stage. + */ + WithCreate withEndOfLifeDate(OffsetDateTime endOfLifeDate); + } + /** The stage of the GalleryImage definition allowing to specify identifier. */ + interface WithIdentifier { + /** + * Specifies the identifier property: This is the gallery image definition identifier.. + * + * @param identifier This is the gallery image definition identifier. + * @return the next definition stage. + */ + WithCreate withIdentifier(GalleryImageIdentifier identifier); + } + /** The stage of the GalleryImage definition allowing to specify recommended. */ + interface WithRecommended { + /** + * Specifies the recommended property: The properties describe the recommended machine configuration for + * this Image Definition. These properties are updatable.. + * + * @param recommended The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * @return the next definition stage. + */ + WithCreate withRecommended(RecommendedMachineConfiguration recommended); + } + /** The stage of the GalleryImage definition allowing to specify disallowed. */ + interface WithDisallowed { + /** + * Specifies the disallowed property: Describes the disallowed disk types.. + * + * @param disallowed Describes the disallowed disk types. + * @return the next definition stage. + */ + WithCreate withDisallowed(Disallowed disallowed); + } + /** The stage of the GalleryImage definition allowing to specify purchasePlan. */ + interface WithPurchasePlan { + /** + * Specifies the purchasePlan property: Describes the gallery image definition purchase plan. This is used + * by marketplace images.. + * + * @param purchasePlan Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * @return the next definition stage. + */ + WithCreate withPurchasePlan(ImagePurchasePlan purchasePlan); + } + /** The stage of the GalleryImage definition allowing to specify features. */ + interface WithFeatures { + /** + * Specifies the features property: A list of gallery image features.. + * + * @param features A list of gallery image features. + * @return the next definition stage. + */ + WithCreate withFeatures(List features); + } + } + /** + * 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, + UpdateStages.WithDescription, + UpdateStages.WithEula, + UpdateStages.WithPrivacyStatementUri, + UpdateStages.WithReleaseNoteUri, + UpdateStages.WithOsType, + UpdateStages.WithOsState, + UpdateStages.WithHyperVGeneration, + UpdateStages.WithEndOfLifeDate, + UpdateStages.WithIdentifier, + UpdateStages.WithRecommended, + UpdateStages.WithDisallowed, + UpdateStages.WithPurchasePlan, + UpdateStages.WithFeatures { + /** + * 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); + } + /** The stage of the GalleryImage update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of this gallery image definition resource. This + * property is updatable.. + * + * @param description The description of this gallery image definition resource. This property is updatable. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the GalleryImage update allowing to specify eula. */ + interface WithEula { + /** + * Specifies the eula property: The Eula agreement for the gallery image definition.. + * + * @param eula The Eula agreement for the gallery image definition. + * @return the next definition stage. + */ + Update withEula(String eula); + } + /** The stage of the GalleryImage update allowing to specify privacyStatementUri. */ + interface WithPrivacyStatementUri { + /** + * Specifies the privacyStatementUri property: The privacy statement uri.. + * + * @param privacyStatementUri The privacy statement uri. + * @return the next definition stage. + */ + Update withPrivacyStatementUri(String privacyStatementUri); + } + /** The stage of the GalleryImage update allowing to specify releaseNoteUri. */ + interface WithReleaseNoteUri { + /** + * Specifies the releaseNoteUri property: The release note uri.. + * + * @param releaseNoteUri The release note uri. + * @return the next definition stage. + */ + Update withReleaseNoteUri(String releaseNoteUri); + } + /** The stage of the GalleryImage update allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: This property allows you to specify the type of the OS that is included in + * the disk when creating a VM from a managed image. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **Linux**. + * + * @param osType This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> + * **Windows** <br><br> **Linux**. + * @return the next definition stage. + */ + Update withOsType(OperatingSystemTypes osType); + } + /** The stage of the GalleryImage update allowing to specify osState. */ + interface WithOsState { + /** + * Specifies the osState property: This property allows the user to specify whether the virtual machines + * created under this image are 'Generalized' or 'Specialized'.. + * + * @param osState This property allows the user to specify whether the virtual machines created under this + * image are 'Generalized' or 'Specialized'. + * @return the next definition stage. + */ + Update withOsState(OperatingSystemStateTypes osState); + } + /** The stage of the GalleryImage update allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to + * OS disks only.. + * + * @param hyperVGeneration The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * @return the next definition stage. + */ + Update withHyperVGeneration(HyperVGeneration hyperVGeneration); + } + /** The stage of the GalleryImage update allowing to specify endOfLifeDate. */ + interface WithEndOfLifeDate { + /** + * Specifies the endOfLifeDate property: The end of life date of the gallery image definition. This property + * can be used for decommissioning purposes. This property is updatable.. + * + * @param endOfLifeDate The end of life date of the gallery image definition. This property can be used for + * decommissioning purposes. This property is updatable. + * @return the next definition stage. + */ + Update withEndOfLifeDate(OffsetDateTime endOfLifeDate); + } + /** The stage of the GalleryImage update allowing to specify identifier. */ + interface WithIdentifier { + /** + * Specifies the identifier property: This is the gallery image definition identifier.. + * + * @param identifier This is the gallery image definition identifier. + * @return the next definition stage. + */ + Update withIdentifier(GalleryImageIdentifier identifier); + } + /** The stage of the GalleryImage update allowing to specify recommended. */ + interface WithRecommended { + /** + * Specifies the recommended property: The properties describe the recommended machine configuration for + * this Image Definition. These properties are updatable.. + * + * @param recommended The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * @return the next definition stage. + */ + Update withRecommended(RecommendedMachineConfiguration recommended); + } + /** The stage of the GalleryImage update allowing to specify disallowed. */ + interface WithDisallowed { + /** + * Specifies the disallowed property: Describes the disallowed disk types.. + * + * @param disallowed Describes the disallowed disk types. + * @return the next definition stage. + */ + Update withDisallowed(Disallowed disallowed); + } + /** The stage of the GalleryImage update allowing to specify purchasePlan. */ + interface WithPurchasePlan { + /** + * Specifies the purchasePlan property: Describes the gallery image definition purchase plan. This is used + * by marketplace images.. + * + * @param purchasePlan Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * @return the next definition stage. + */ + Update withPurchasePlan(ImagePurchasePlan purchasePlan); + } + /** The stage of the GalleryImage update allowing to specify features. */ + interface WithFeatures { + /** + * Specifies the features property: A list of gallery image features.. + * + * @param features A list of gallery image features. + * @return the next definition stage. + */ + Update withFeatures(List features); + } + } + /** + * 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/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageFeature.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageFeature.java new file mode 100644 index 0000000000000..71dbf1e8b3944 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageFeature.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A feature for gallery image. */ +@Fluent +public final class GalleryImageFeature { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageFeature.class); + + /* + * The name of the gallery image feature. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the gallery image feature. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the gallery image feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the gallery image feature. + * + * @param name the name value to set. + * @return the GalleryImageFeature object itself. + */ + public GalleryImageFeature withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the gallery image feature. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the gallery image feature. + * + * @param value the value value to set. + * @return the GalleryImageFeature object itself. + */ + public GalleryImageFeature withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageIdentifier.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageIdentifier.java new file mode 100644 index 0000000000000..bbd4db39ce1a7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageIdentifier.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This is the gallery image definition identifier. */ +@Fluent +public final class GalleryImageIdentifier { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageIdentifier.class); + + /* + * The name of the gallery image definition publisher. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The name of the gallery image definition offer. + */ + @JsonProperty(value = "offer", required = true) + private String offer; + + /* + * The name of the gallery image definition SKU. + */ + @JsonProperty(value = "sku", required = true) + private String sku; + + /** + * 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 + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisher in model GalleryImageIdentifier")); + } + if (offer() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property offer in model GalleryImageIdentifier")); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model GalleryImageIdentifier")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageList.java new file mode 100644 index 0000000000000..bb3b7fbc239f8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageList.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Gallery Images operation response. */ +@Fluent +public final class GalleryImageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageList.class); + + /* + * A list of Shared Image Gallery images. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Image Definitions in the Shared Image + * Gallery. Call ListNext() with this to fetch the next page of gallery + * image definitions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of Shared Image Gallery images. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Shared Image Gallery images. + * + * @param value the value value to set. + * @return the GalleryImageList object itself. + */ + public GalleryImageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call + * ListNext() with this to fetch the next page of gallery image definitions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call + * ListNext() with this to fetch the next page of gallery image definitions. + * + * @param nextLink the nextLink value to set. + * @return the GalleryImageList object itself. + */ + public GalleryImageList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model GalleryImageList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImagePropertiesProvisioningState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImagePropertiesProvisioningState.java new file mode 100644 index 0000000000000..9852c086e495b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImagePropertiesProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GalleryImagePropertiesProvisioningState. */ +public final class GalleryImagePropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Failed for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Migrating for GalleryImagePropertiesProvisioningState. */ + public static final GalleryImagePropertiesProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a GalleryImagePropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding GalleryImagePropertiesProvisioningState. + */ + @JsonCreator + public static GalleryImagePropertiesProvisioningState fromString(String name) { + return fromString(name, GalleryImagePropertiesProvisioningState.class); + } + + /** @return known GalleryImagePropertiesProvisioningState values. */ + public static Collection values() { + return values(GalleryImagePropertiesProvisioningState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageUpdate.java new file mode 100644 index 0000000000000..fe57105c9d346 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageUpdate.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Specifies information about the gallery image definition that you want to update. */ +@Fluent +public final class GalleryImageUpdate extends UpdateResourceDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageUpdate.class); + + /* + * Describes the properties of a gallery image definition. + */ + @JsonProperty(value = "properties") + private GalleryImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image definition. + * + * @return the innerProperties value. + */ + private GalleryImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this gallery image definition resource. This property is + * updatable. + * + * @param description the description value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the eula property: The Eula agreement for the gallery image definition. + * + * @return the eula value. + */ + public String eula() { + return this.innerProperties() == null ? null : this.innerProperties().eula(); + } + + /** + * Set the eula property: The Eula agreement for the gallery image definition. + * + * @param eula the eula value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withEula(String eula) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withEula(eula); + return this; + } + + /** + * Get the privacyStatementUri property: The privacy statement uri. + * + * @return the privacyStatementUri value. + */ + public String privacyStatementUri() { + return this.innerProperties() == null ? null : this.innerProperties().privacyStatementUri(); + } + + /** + * Set the privacyStatementUri property: The privacy statement uri. + * + * @param privacyStatementUri the privacyStatementUri value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withPrivacyStatementUri(String privacyStatementUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withPrivacyStatementUri(privacyStatementUri); + return this; + } + + /** + * Get the releaseNoteUri property: The release note uri. + * + * @return the releaseNoteUri value. + */ + public String releaseNoteUri() { + return this.innerProperties() == null ? null : this.innerProperties().releaseNoteUri(); + } + + /** + * Set the releaseNoteUri property: The release note uri. + * + * @param releaseNoteUri the releaseNoteUri value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withReleaseNoteUri(String releaseNoteUri) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withReleaseNoteUri(releaseNoteUri); + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the disk when + * creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.innerProperties() == null ? null : this.innerProperties().osState(); + } + + /** + * Set the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @param osState the osState value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withOsState(OperatingSystemStateTypes osState) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withOsState(osState); + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withHyperVGeneration(HyperVGeneration hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Get the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + public OffsetDateTime endOfLifeDate() { + return this.innerProperties() == null ? null : this.innerProperties().endOfLifeDate(); + } + + /** + * Set the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @param endOfLifeDate the endOfLifeDate value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withIdentifier(GalleryImageIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + public RecommendedMachineConfiguration recommended() { + return this.innerProperties() == null ? null : this.innerProperties().recommended(); + } + + /** + * Set the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @param recommended the recommended value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withRecommended(RecommendedMachineConfiguration recommended) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withRecommended(recommended); + return this; + } + + /** + * Get the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + public Disallowed disallowed() { + return this.innerProperties() == null ? null : this.innerProperties().disallowed(); + } + + /** + * Set the disallowed property: Describes the disallowed disk types. + * + * @param disallowed the disallowed value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withDisallowed(Disallowed disallowed) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withDisallowed(disallowed); + return this; + } + + /** + * Get the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + public ImagePurchasePlan purchasePlan() { + return this.innerProperties() == null ? null : this.innerProperties().purchasePlan(); + } + + /** + * Set the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @param purchasePlan the purchasePlan value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withPurchasePlan(ImagePurchasePlan purchasePlan) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withPurchasePlan(purchasePlan); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image definition. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImagePropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the features property: A list of gallery image features. + * + * @return the features value. + */ + public List features() { + return this.innerProperties() == null ? null : this.innerProperties().features(); + } + + /** + * Set the features property: A list of gallery image features. + * + * @param features the features value to set. + * @return the GalleryImageUpdate object itself. + */ + public GalleryImageUpdate withFeatures(List features) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageProperties(); + } + this.innerProperties().withFeatures(features); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersion.java new file mode 100644 index 0000000000000..244429751f4ae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersion.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner; +import java.util.Map; + +/** An immutable client-side representation of GalleryImageVersion. */ +public interface GalleryImageVersion { + /** + * 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 publishingProfile property: The publishing profile of a gallery image Version. + * + * @return the publishingProfile value. + */ + GalleryImageVersionPublishingProfile publishingProfile(); + + /** + * Gets the provisioningState property: The current state of the gallery image version. The provisioning state, + * which only appears in the response. + * + * @return the provisioningState value. + */ + GalleryImageVersionPropertiesProvisioningState provisioningState(); + + /** + * Gets the storageProfile property: This is the storage profile of a Gallery Image Version. + * + * @return the storageProfile value. + */ + GalleryImageVersionStorageProfile storageProfile(); + + /** + * Gets the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + ReplicationStatus replicationStatus(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner object. + * + * @return the inner object. + */ + GalleryImageVersionInner innerModel(); + + /** The entirety of the GalleryImageVersion definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The GalleryImageVersion definition stages. */ + interface DefinitionStages { + /** The first stage of the GalleryImageVersion definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GalleryImageVersion definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the GalleryImageVersion definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, galleryName, galleryImageName. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version is to be + * created. + * @return the next definition stage. + */ + WithCreate withExistingImage(String resourceGroupName, String galleryName, String galleryImageName); + } + /** + * The stage of the GalleryImageVersion 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.WithPublishingProfile, + DefinitionStages.WithStorageProfile { + /** + * Executes the create request. + * + * @return the created resource. + */ + GalleryImageVersion create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GalleryImageVersion create(Context context); + } + /** The stage of the GalleryImageVersion 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 GalleryImageVersion definition allowing to specify publishingProfile. */ + interface WithPublishingProfile { + /** + * Specifies the publishingProfile property: The publishing profile of a gallery image Version.. + * + * @param publishingProfile The publishing profile of a gallery image Version. + * @return the next definition stage. + */ + WithCreate withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile); + } + /** The stage of the GalleryImageVersion definition allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: This is the storage profile of a Gallery Image Version.. + * + * @param storageProfile This is the storage profile of a Gallery Image Version. + * @return the next definition stage. + */ + WithCreate withStorageProfile(GalleryImageVersionStorageProfile storageProfile); + } + } + /** + * Begins update for the GalleryImageVersion resource. + * + * @return the stage of resource update. + */ + GalleryImageVersion.Update update(); + + /** The template for GalleryImageVersion update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithPublishingProfile, UpdateStages.WithStorageProfile { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GalleryImageVersion apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GalleryImageVersion apply(Context context); + } + /** The GalleryImageVersion update stages. */ + interface UpdateStages { + /** The stage of the GalleryImageVersion 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 GalleryImageVersion update allowing to specify publishingProfile. */ + interface WithPublishingProfile { + /** + * Specifies the publishingProfile property: The publishing profile of a gallery image Version.. + * + * @param publishingProfile The publishing profile of a gallery image Version. + * @return the next definition stage. + */ + Update withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile); + } + /** The stage of the GalleryImageVersion update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: This is the storage profile of a Gallery Image Version.. + * + * @param storageProfile This is the storage profile of a Gallery Image Version. + * @return the next definition stage. + */ + Update withStorageProfile(GalleryImageVersionStorageProfile storageProfile); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GalleryImageVersion refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GalleryImageVersion refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionList.java new file mode 100644 index 0000000000000..d422f995d9d37 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Gallery Image version operation response. */ +@Fluent +public final class GalleryImageVersionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionList.class); + + /* + * A list of gallery image versions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of gallery image versions. Call + * ListNext() with this to fetch the next page of gallery image versions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of gallery image versions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of gallery image versions. + * + * @param value the value value to set. + * @return the GalleryImageVersionList object itself. + */ + public GalleryImageVersionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of gallery image versions. Call ListNext() with this to + * fetch the next page of gallery image versions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of gallery image versions. Call ListNext() with this to + * fetch the next page of gallery image versions. + * + * @param nextLink the nextLink value to set. + * @return the GalleryImageVersionList object itself. + */ + public GalleryImageVersionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model GalleryImageVersionList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPropertiesProvisioningState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPropertiesProvisioningState.java new file mode 100644 index 0000000000000..37e60ac8f5f95 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPropertiesProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GalleryImageVersionPropertiesProvisioningState. */ +public final class GalleryImageVersionPropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Failed for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Migrating for GalleryImageVersionPropertiesProvisioningState. */ + public static final GalleryImageVersionPropertiesProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a GalleryImageVersionPropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding GalleryImageVersionPropertiesProvisioningState. + */ + @JsonCreator + public static GalleryImageVersionPropertiesProvisioningState fromString(String name) { + return fromString(name, GalleryImageVersionPropertiesProvisioningState.class); + } + + /** @return known GalleryImageVersionPropertiesProvisioningState values. */ + public static Collection values() { + return values(GalleryImageVersionPropertiesProvisioningState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPublishingProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPublishingProfile.java new file mode 100644 index 0000000000000..943a297397edb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionPublishingProfile.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; +import java.util.List; + +/** The publishing profile of a gallery image Version. */ +@Fluent +public final class GalleryImageVersionPublishingProfile extends GalleryArtifactPublishingProfileBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionPublishingProfile.class); + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withTargetRegions(List targetRegions) { + super.withTargetRegions(targetRegions); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withReplicaCount(Integer replicaCount) { + super.withReplicaCount(replicaCount); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withExcludeFromLatest(Boolean excludeFromLatest) { + super.withExcludeFromLatest(excludeFromLatest); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withEndOfLifeDate(OffsetDateTime endOfLifeDate) { + super.withEndOfLifeDate(endOfLifeDate); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withStorageAccountType(StorageAccountType storageAccountType) { + super.withStorageAccountType(storageAccountType); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionPublishingProfile withReplicationMode(ReplicationMode replicationMode) { + super.withReplicationMode(replicationMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionStorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionStorageProfile.java new file mode 100644 index 0000000000000..90d843f54023f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionStorageProfile.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This is the storage profile of a Gallery Image Version. */ +@Fluent +public final class GalleryImageVersionStorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionStorageProfile.class); + + /* + * The gallery artifact version source. + */ + @JsonProperty(value = "source") + private GalleryArtifactVersionSource source; + + /* + * This is the OS disk image. + */ + @JsonProperty(value = "osDiskImage") + private GalleryOSDiskImage osDiskImage; + + /* + * A list of data disk images. + */ + @JsonProperty(value = "dataDiskImages") + private List dataDiskImages; + + /** + * Get the source property: The gallery artifact version source. + * + * @return the source value. + */ + public GalleryArtifactVersionSource source() { + return this.source; + } + + /** + * Set the source property: The gallery artifact version source. + * + * @param source the source value to set. + * @return the GalleryImageVersionStorageProfile object itself. + */ + public GalleryImageVersionStorageProfile withSource(GalleryArtifactVersionSource source) { + this.source = source; + return this; + } + + /** + * 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; + } + + /** + * Get the dataDiskImages property: A list of data disk images. + * + * @return the dataDiskImages value. + */ + public List dataDiskImages() { + return this.dataDiskImages; + } + + /** + * Set the dataDiskImages property: A list of data disk images. + * + * @param dataDiskImages the dataDiskImages value to set. + * @return the GalleryImageVersionStorageProfile object itself. + */ + public GalleryImageVersionStorageProfile withDataDiskImages(List dataDiskImages) { + this.dataDiskImages = dataDiskImages; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (osDiskImage() != null) { + osDiskImage().validate(); + } + if (dataDiskImages() != null) { + dataDiskImages().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionUpdate.java new file mode 100644 index 0000000000000..8af7d0e9eaac2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersionUpdate.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryImageVersionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the gallery image version that you want to update. */ +@Fluent +public final class GalleryImageVersionUpdate extends UpdateResourceDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageVersionUpdate.class); + + /* + * Describes the properties of a gallery image version. + */ + @JsonProperty(value = "properties") + private GalleryImageVersionProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private GalleryImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageVersionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publishingProfile property: The publishing profile of a gallery image Version. + * + * @return the publishingProfile value. + */ + public GalleryImageVersionPublishingProfile publishingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().publishingProfile(); + } + + /** + * Set the publishingProfile property: The publishing profile of a gallery image Version. + * + * @param publishingProfile the publishingProfile value to set. + * @return the GalleryImageVersionUpdate object itself. + */ + public GalleryImageVersionUpdate withPublishingProfile(GalleryImageVersionPublishingProfile publishingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageVersionProperties(); + } + this.innerProperties().withPublishingProfile(publishingProfile); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery image version. The provisioning state, which + * only appears in the response. + * + * @return the provisioningState value. + */ + public GalleryImageVersionPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * 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 GalleryImageVersionUpdate object itself. + */ + public GalleryImageVersionUpdate withStorageProfile(GalleryImageVersionStorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageVersionProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the replicationStatus property: This is the replication status of the gallery image version. + * + * @return the replicationStatus value. + */ + public ReplicationStatus replicationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().replicationStatus(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersions.java new file mode 100644 index 0000000000000..2cf6f605e91fa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImageVersions.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 GalleryImageVersions. */ +public interface GalleryImageVersions { + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update. + */ + GalleryImageVersion get( + String resourceGroupName, String galleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Retrieves information about a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be retrieved. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, + String galleryName, + String galleryImageName, + String galleryImageVersionName, + ReplicationStatusTypes expand, + Context context); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName, String galleryImageVersionName); + + /** + * Delete a gallery image version. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the gallery image definition in which the Image Version resides. + * @param galleryImageVersionName The name of the gallery image version to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, + String galleryImageName, + String galleryImageVersionName, + Context context); + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName); + + /** + * List gallery image versions in a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides. + * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are + * to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Image version operation response. + */ + PagedIterable listByGalleryImage( + String resourceGroupName, String galleryName, String galleryImageName, Context context); + + /** + * Retrieves information about a gallery image version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response}. + */ + GalleryImageVersion getById(String id); + + /** + * Retrieves information about a gallery image version. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image version that you want to create or update along with {@link + * Response}. + */ + Response getByIdWithResponse(String id, ReplicationStatusTypes expand, Context context); + + /** + * Delete a gallery image version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a gallery image version. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 GalleryImageVersion resource. + * + * @param name resource name. + * @return the first stage of the new GalleryImageVersion definition. + */ + GalleryImageVersion.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImages.java new file mode 100644 index 0000000000000..f4acaaa55772a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryImages.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 { + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update. + */ + GalleryImage get(String resourceGroupName, String galleryName, String galleryImageName); + + /** + * Retrieves information about a gallery image definition. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. + * @param galleryImageName The name of the gallery image definition to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String galleryName, String galleryImageName, Context context); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName); + + /** + * Delete a gallery image. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery in which the Image Definition is to be deleted. + * @param galleryImageName The name of the gallery image definition to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 galleryName, String galleryImageName, Context context); + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + PagedIterable listByGallery(String resourceGroupName, String galleryName); + + /** + * List gallery image definitions in a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery from which Image Definitions are to be listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Gallery Images operation response. + */ + PagedIterable listByGallery(String resourceGroupName, String galleryName, Context context); + + /** + * Retrieves information about a gallery image definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response}. + */ + GalleryImage getById(String id); + + /** + * Retrieves information about a gallery image definition. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery image definition that you want to create or update along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a gallery image. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a 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.resourcemanager.compute.generated.models.ApiErrorException 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/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryList.java new file mode 100644 index 0000000000000..df60391645c12 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Galleries operation response. */ +@Fluent +public final class GalleryList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryList.class); + + /* + * A list of galleries. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of galleries. Call ListNext() with this + * to fetch the next page of galleries. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of galleries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of galleries. + * + * @param value the value value to set. + * @return the GalleryList object itself. + */ + public GalleryList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the + * next page of galleries. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of galleries. Call ListNext() with this to fetch the + * next page of galleries. + * + * @param nextLink the nextLink value to set. + * @return the GalleryList object itself. + */ + public GalleryList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model GalleryList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryOSDiskImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryOSDiskImage.java new file mode 100644 index 0000000000000..a55d45e0e3cb4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryOSDiskImage.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** This is the OS disk image. */ +@Fluent +public final class GalleryOSDiskImage extends GalleryDiskImage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryOSDiskImage.class); + + /** {@inheritDoc} */ + @Override + public GalleryOSDiskImage withHostCaching(HostCaching hostCaching) { + super.withHostCaching(hostCaching); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryOSDiskImage withSource(GalleryArtifactVersionSource source) { + super.withSource(source); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryPropertiesProvisioningState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryPropertiesProvisioningState.java new file mode 100644 index 0000000000000..7d10b29156419 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryPropertiesProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GalleryPropertiesProvisioningState. */ +public final class GalleryPropertiesProvisioningState extends ExpandableStringEnum { + /** Static value Creating for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Failed for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Migrating for GalleryPropertiesProvisioningState. */ + public static final GalleryPropertiesProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a GalleryPropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding GalleryPropertiesProvisioningState. + */ + @JsonCreator + public static GalleryPropertiesProvisioningState fromString(String name) { + return fromString(name, GalleryPropertiesProvisioningState.class); + } + + /** @return known GalleryPropertiesProvisioningState values. */ + public static Collection values() { + return values(GalleryPropertiesProvisioningState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingPermissionTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingPermissionTypes.java new file mode 100644 index 0000000000000..a456bd009b7ec --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingPermissionTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GallerySharingPermissionTypes. */ +public final class GallerySharingPermissionTypes extends ExpandableStringEnum { + /** Static value Private for GallerySharingPermissionTypes. */ + public static final GallerySharingPermissionTypes PRIVATE = fromString("Private"); + + /** Static value Groups for GallerySharingPermissionTypes. */ + public static final GallerySharingPermissionTypes GROUPS = fromString("Groups"); + + /** + * Creates or finds a GallerySharingPermissionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding GallerySharingPermissionTypes. + */ + @JsonCreator + public static GallerySharingPermissionTypes fromString(String name) { + return fromString(name, GallerySharingPermissionTypes.class); + } + + /** @return known GallerySharingPermissionTypes values. */ + public static Collection values() { + return values(GallerySharingPermissionTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingProfiles.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingProfiles.java new file mode 100644 index 0000000000000..4bc80fe16532a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GallerySharingProfiles.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; + +/** Resource collection API of GallerySharingProfiles. */ +public interface GallerySharingProfiles { + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + SharingUpdate update(String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate); + + /** + * Update sharing profile of a gallery. + * + * @param resourceGroupName The name of the resource group. + * @param galleryName The name of the Shared Image Gallery. + * @param sharingUpdate Parameters supplied to the update gallery sharing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the gallery sharing profile update. + */ + SharingUpdate update( + String resourceGroupName, String galleryName, SharingUpdateInner sharingUpdate, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryUpdate.java new file mode 100644 index 0000000000000..eefbed5afddb6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GalleryUpdate.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.GalleryProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the Shared Image Gallery that you want to update. */ +@Fluent +public final class GalleryUpdate extends UpdateResourceDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryUpdate.class); + + /* + * Describes the properties of a Shared Image Gallery. + */ + @JsonProperty(value = "properties") + private GalleryProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Shared Image Gallery. + * + * @return the innerProperties value. + */ + private GalleryProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GalleryUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of this Shared Image Gallery resource. This property is updatable. + * + * @param description the description value to set. + * @return the GalleryUpdate object itself. + */ + public GalleryUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the identifier property: Describes the gallery unique name. + * + * @return the identifier value. + */ + public GalleryIdentifier identifier() { + return this.innerProperties() == null ? null : this.innerProperties().identifier(); + } + + /** + * Set the identifier property: Describes the gallery unique name. + * + * @param identifier the identifier value to set. + * @return the GalleryUpdate object itself. + */ + public GalleryUpdate withIdentifier(GalleryIdentifier identifier) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withIdentifier(identifier); + return this; + } + + /** + * Get the provisioningState property: The current state of the gallery. The provisioning state, which only appears + * in the response. + * + * @return the provisioningState value. + */ + public GalleryPropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @return the sharingProfile value. + */ + public SharingProfile sharingProfile() { + return this.innerProperties() == null ? null : this.innerProperties().sharingProfile(); + } + + /** + * Set the sharingProfile property: Profile for gallery sharing to subscription or tenant. + * + * @param sharingProfile the sharingProfile value to set. + * @return the GalleryUpdate object itself. + */ + public GalleryUpdate withSharingProfile(SharingProfile sharingProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withSharingProfile(sharingProfile); + return this; + } + + /** + * Get the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @return the softDeletePolicy value. + */ + public SoftDeletePolicy softDeletePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().softDeletePolicy(); + } + + /** + * Set the softDeletePolicy property: Contains information about the soft deletion policy of the gallery. + * + * @param softDeletePolicy the softDeletePolicy value to set. + * @return the GalleryUpdate object itself. + */ + public GalleryUpdate withSoftDeletePolicy(SoftDeletePolicy softDeletePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryProperties(); + } + this.innerProperties().withSoftDeletePolicy(softDeletePolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GrantAccessData.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GrantAccessData.java new file mode 100644 index 0000000000000..39576a328e60f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/GrantAccessData.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Data used for requesting a SAS. */ +@Fluent +public final class GrantAccessData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GrantAccessData.class); + + /* + * The access property. + */ + @JsonProperty(value = "access", required = true) + private AccessLevel access; + + /* + * Time duration in seconds until the SAS access expires. + */ + @JsonProperty(value = "durationInSeconds", required = true) + private int durationInSeconds; + + /* + * Set this flag to true to get additional SAS for VM guest state + */ + @JsonProperty(value = "getSecureVMGuestStateSAS") + private Boolean getSecureVMGuestStateSas; + + /** + * Get the access property: The access property. + * + * @return the access value. + */ + public AccessLevel access() { + return this.access; + } + + /** + * Set the access property: The access property. + * + * @param access the access value to set. + * @return the GrantAccessData object itself. + */ + public GrantAccessData withAccess(AccessLevel access) { + this.access = access; + return this; + } + + /** + * Get the durationInSeconds property: Time duration in seconds until the SAS access expires. + * + * @return the durationInSeconds value. + */ + public int durationInSeconds() { + return this.durationInSeconds; + } + + /** + * Set the durationInSeconds property: Time duration in seconds until the SAS access expires. + * + * @param durationInSeconds the durationInSeconds value to set. + * @return the GrantAccessData object itself. + */ + public GrantAccessData withDurationInSeconds(int durationInSeconds) { + this.durationInSeconds = durationInSeconds; + return this; + } + + /** + * Get the getSecureVMGuestStateSas property: Set this flag to true to get additional SAS for VM guest state. + * + * @return the getSecureVMGuestStateSas value. + */ + public Boolean getSecureVMGuestStateSas() { + return this.getSecureVMGuestStateSas; + } + + /** + * Set the getSecureVMGuestStateSas property: Set this flag to true to get additional SAS for VM guest state. + * + * @param getSecureVMGuestStateSas the getSecureVMGuestStateSas value to set. + * @return the GrantAccessData object itself. + */ + public GrantAccessData withGetSecureVMGuestStateSas(Boolean getSecureVMGuestStateSas) { + this.getSecureVMGuestStateSas = getSecureVMGuestStateSas; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (access() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property access in model GrantAccessData")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HardwareProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HardwareProfile.java new file mode 100644 index 0000000000000..e09ef258be608 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HardwareProfile.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the hardware settings for the virtual machine. */ +@Fluent +public final class HardwareProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HardwareProfile.class); + + /* + * Specifies the size of the virtual machine.

    The enum data type + * is currently deprecated and will be removed by December 23rd 2023. + *

    Recommended way to get the list of available sizes is using + * these APIs:

    [List all available virtual machine sizes in an + * availability + * set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) + *

    [List all available virtual machine sizes in a region]( + * https://docs.microsoft.com/rest/api/compute/resourceskus/list)

    + * [List all available virtual machine sizes for + * resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + * For more information about virtual machine sizes, see [Sizes for virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/sizes). + *

    The available VM sizes depend on region and availability set. + */ + @JsonProperty(value = "vmSize") + private VirtualMachineSizeTypes vmSize; + + /* + * Specifies the properties for customizing the size of the virtual + * machine. Minimum api-version: 2021-07-01.

    This feature is still + * in preview mode and is not supported for VirtualMachineScaleSet. + *

    Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + */ + @JsonProperty(value = "vmSizeProperties") + private VMSizeProperties vmSizeProperties; + + /** + * Get the vmSize property: Specifies the size of the virtual machine. <br><br> The enum data type is + * currently deprecated and will be removed by December 23rd 2023. <br><br> Recommended way to get the + * list of available sizes is using these APIs: <br><br> [List all available virtual machine sizes in an + * availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) + * <br><br> [List all available virtual machine sizes in a region]( + * https://docs.microsoft.com/rest/api/compute/resourceskus/list) <br><br> [List all available virtual + * machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). For + * more information about virtual machine sizes, see [Sizes for virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/sizes). <br><br> The available VM sizes + * depend on region and availability set. + * + * @return the vmSize value. + */ + public VirtualMachineSizeTypes vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: Specifies the size of the virtual machine. <br><br> The enum data type is + * currently deprecated and will be removed by December 23rd 2023. <br><br> Recommended way to get the + * list of available sizes is using these APIs: <br><br> [List all available virtual machine sizes in an + * availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) + * <br><br> [List all available virtual machine sizes in a region]( + * https://docs.microsoft.com/rest/api/compute/resourceskus/list) <br><br> [List all available virtual + * machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). For + * more information about virtual machine sizes, see [Sizes for virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/sizes). <br><br> The available VM sizes + * depend on region and availability set. + * + * @param vmSize the vmSize value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withVmSize(VirtualMachineSizeTypes vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-07-01. <br><br> This feature is still in preview mode and is not supported + * for VirtualMachineScaleSet. <br><br> Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @return the vmSizeProperties value. + */ + public VMSizeProperties vmSizeProperties() { + return this.vmSizeProperties; + } + + /** + * Set the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-07-01. <br><br> This feature is still in preview mode and is not supported + * for VirtualMachineScaleSet. <br><br> Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @param vmSizeProperties the vmSizeProperties value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withVmSizeProperties(VMSizeProperties vmSizeProperties) { + this.vmSizeProperties = vmSizeProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmSizeProperties() != null) { + vmSizeProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HostCaching.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HostCaching.java new file mode 100644 index 0000000000000..16fb1ee7308de --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HostCaching.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for HostCaching. */ +public enum HostCaching { + /** Enum value None. */ + NONE("None"), + + /** Enum value ReadOnly. */ + READ_ONLY("ReadOnly"), + + /** Enum value ReadWrite. */ + READ_WRITE("ReadWrite"); + + /** The actual serialized value for a HostCaching instance. */ + private final String value; + + HostCaching(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a HostCaching instance. + * + * @param value the serialized value to parse. + * @return the parsed HostCaching object, or null if unable to parse. + */ + @JsonCreator + public static HostCaching fromString(String value) { + HostCaching[] items = HostCaching.values(); + for (HostCaching item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGeneration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGeneration.java new file mode 100644 index 0000000000000..5bbae09840d6e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGeneration.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HyperVGeneration. */ +public final class HyperVGeneration extends ExpandableStringEnum { + /** Static value V1 for HyperVGeneration. */ + public static final HyperVGeneration V1 = fromString("V1"); + + /** Static value V2 for HyperVGeneration. */ + public static final HyperVGeneration V2 = fromString("V2"); + + /** + * Creates or finds a HyperVGeneration from its string representation. + * + * @param name a name to look for. + * @return the corresponding HyperVGeneration. + */ + @JsonCreator + public static HyperVGeneration fromString(String name) { + return fromString(name, HyperVGeneration.class); + } + + /** @return known HyperVGeneration values. */ + public static Collection values() { + return values(HyperVGeneration.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationType.java new file mode 100644 index 0000000000000..0fd88af98b236 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HyperVGenerationType. */ +public final class HyperVGenerationType extends ExpandableStringEnum { + /** Static value V1 for HyperVGenerationType. */ + public static final HyperVGenerationType V1 = fromString("V1"); + + /** Static value V2 for HyperVGenerationType. */ + public static final HyperVGenerationType V2 = fromString("V2"); + + /** + * Creates or finds a HyperVGenerationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HyperVGenerationType. + */ + @JsonCreator + public static HyperVGenerationType fromString(String name) { + return fromString(name, HyperVGenerationType.class); + } + + /** @return known HyperVGenerationType values. */ + public static Collection values() { + return values(HyperVGenerationType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationTypes.java new file mode 100644 index 0000000000000..59379477e1ad8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/HyperVGenerationTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HyperVGenerationTypes. */ +public final class HyperVGenerationTypes extends ExpandableStringEnum { + /** Static value V1 for HyperVGenerationTypes. */ + public static final HyperVGenerationTypes V1 = fromString("V1"); + + /** Static value V2 for HyperVGenerationTypes. */ + public static final HyperVGenerationTypes V2 = fromString("V2"); + + /** + * Creates or finds a HyperVGenerationTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding HyperVGenerationTypes. + */ + @JsonCreator + public static HyperVGenerationTypes fromString(String name) { + return fromString(name, HyperVGenerationTypes.class); + } + + /** @return known HyperVGenerationTypes values. */ + public static Collection values() { + return values(HyperVGenerationTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Image.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Image.java new file mode 100644 index 0000000000000..b4e697d28fd55 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Image.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageInner; +import java.util.Map; + +/** An immutable client-side representation of Image. */ +public interface Image { + /** + * 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 extendedLocation property: The extended location of the Image. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @return the sourceVirtualMachine value. + */ + SubResource sourceVirtualMachine(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + ImageStorageProfile storageProfile(); + + /** + * Gets the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @return the hyperVGeneration value. + */ + HyperVGenerationTypes hyperVGeneration(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.ImageInner object. + * + * @return the inner object. + */ + ImageInner innerModel(); + + /** The entirety of the Image definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Image definition stages. */ + interface DefinitionStages { + /** The first stage of the Image definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Image 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 Image definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Image 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.WithExtendedLocation, + DefinitionStages.WithSourceVirtualMachine, + DefinitionStages.WithStorageProfile, + DefinitionStages.WithHyperVGeneration { + /** + * Executes the create request. + * + * @return the created resource. + */ + Image create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Image create(Context context); + } + /** The stage of the Image 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 Image definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location of the Image.. + * + * @param extendedLocation The extended location of the Image. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the Image definition allowing to specify sourceVirtualMachine. */ + interface WithSourceVirtualMachine { + /** + * Specifies the sourceVirtualMachine property: The source virtual machine from which Image is created.. + * + * @param sourceVirtualMachine The source virtual machine from which Image is created. + * @return the next definition stage. + */ + WithCreate withSourceVirtualMachine(SubResource sourceVirtualMachine); + } + /** The stage of the Image definition allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Specifies the storage settings for the virtual machine disks.. + * + * @param storageProfile Specifies the storage settings for the virtual machine disks. + * @return the next definition stage. + */ + WithCreate withStorageProfile(ImageStorageProfile storageProfile); + } + /** The stage of the Image definition allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created + * from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to + * specify the value, if the source is managed resource like disk or snapshot, we may require the user to + * specify the property if we cannot deduce it from the source managed resource.. + * + * @param hyperVGeneration Specifies the HyperVGenerationType of the VirtualMachine created from the image. + * From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the + * value, if the source is managed resource like disk or snapshot, we may require the user to specify + * the property if we cannot deduce it from the source managed resource. + * @return the next definition stage. + */ + WithCreate withHyperVGeneration(HyperVGenerationTypes hyperVGeneration); + } + } + /** + * Begins update for the Image resource. + * + * @return the stage of resource update. + */ + Image.Update update(); + + /** The template for Image update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSourceVirtualMachine, + UpdateStages.WithStorageProfile, + UpdateStages.WithHyperVGeneration { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Image apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Image apply(Context context); + } + /** The Image update stages. */ + interface UpdateStages { + /** The stage of the Image 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 Image update allowing to specify sourceVirtualMachine. */ + interface WithSourceVirtualMachine { + /** + * Specifies the sourceVirtualMachine property: The source virtual machine from which Image is created.. + * + * @param sourceVirtualMachine The source virtual machine from which Image is created. + * @return the next definition stage. + */ + Update withSourceVirtualMachine(SubResource sourceVirtualMachine); + } + /** The stage of the Image update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Specifies the storage settings for the virtual machine disks.. + * + * @param storageProfile Specifies the storage settings for the virtual machine disks. + * @return the next definition stage. + */ + Update withStorageProfile(ImageStorageProfile storageProfile); + } + /** The stage of the Image update allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created + * from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to + * specify the value, if the source is managed resource like disk or snapshot, we may require the user to + * specify the property if we cannot deduce it from the source managed resource.. + * + * @param hyperVGeneration Specifies the HyperVGenerationType of the VirtualMachine created from the image. + * From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the + * value, if the source is managed resource like disk or snapshot, we may require the user to specify + * the property if we cannot deduce it from the source managed resource. + * @return the next definition stage. + */ + Update withHyperVGeneration(HyperVGenerationTypes hyperVGeneration); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Image refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Image refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDataDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDataDisk.java new file mode 100644 index 0000000000000..f333e39c55e91 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDataDisk.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a data disk. */ +@Fluent +public final class ImageDataDisk extends ImageDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageDataDisk.class); + + /* + * Specifies the logical unit number of the data disk. This value is used + * to identify data disks within the VM and therefore must be unique for + * each data disk attached to a VM. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @param lun the lun value to set. + * @return the ImageDataDisk object itself. + */ + public ImageDataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withSnapshot(SubResource snapshot) { + super.withSnapshot(snapshot); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withManagedDisk(SubResource managedDisk) { + super.withManagedDisk(managedDisk); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withBlobUri(String blobUri) { + super.withBlobUri(blobUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withCaching(CachingTypes caching) { + super.withCaching(caching); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withDiskSizeGB(Integer diskSizeGB) { + super.withDiskSizeGB(diskSizeGB); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withStorageAccountType(StorageAccountTypes storageAccountType) { + super.withStorageAccountType(storageAccountType); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageDataDisk withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + super.withDiskEncryptionSet(diskEncryptionSet); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDisk.java new file mode 100644 index 0000000000000..d317d50088bc4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDisk.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a image disk. */ +@Fluent +public class ImageDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageDisk.class); + + /* + * The snapshot. + */ + @JsonProperty(value = "snapshot") + private SubResource snapshot; + + /* + * The managedDisk. + */ + @JsonProperty(value = "managedDisk") + private SubResource managedDisk; + + /* + * The Virtual Hard Disk. + */ + @JsonProperty(value = "blobUri") + private String blobUri; + + /* + * Specifies the caching requirements.

    Possible values are: + *

    **None**

    **ReadOnly**

    **ReadWrite**

    + * Default: **None for Standard storage. ReadOnly for Premium storage** + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies the size of empty data disks in gigabytes. This element can be + * used to overwrite the name of the disk in a virtual machine image. + *

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Specifies the storage account type for the managed disk. NOTE: + * UltraSSD_LRS can only be used with data disks, it cannot be used with OS + * Disk. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountTypes storageAccountType; + + /* + * Specifies the customer managed disk encryption set resource id for the + * managed image disk. + */ + @JsonProperty(value = "diskEncryptionSet") + private DiskEncryptionSetParameters diskEncryptionSet; + + /** + * Get the snapshot property: The snapshot. + * + * @return the snapshot value. + */ + public SubResource snapshot() { + return this.snapshot; + } + + /** + * Set the snapshot property: The snapshot. + * + * @param snapshot the snapshot value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withSnapshot(SubResource snapshot) { + this.snapshot = snapshot; + return this; + } + + /** + * Get the managedDisk property: The managedDisk. + * + * @return the managedDisk value. + */ + public SubResource managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managedDisk. + * + * @param managedDisk the managedDisk value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withManagedDisk(SubResource managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the blobUri property: The Virtual Hard Disk. + * + * @return the blobUri value. + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Set the blobUri property: The Virtual Hard Disk. + * + * @param blobUri the blobUri value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withBlobUri(String blobUri) { + this.blobUri = blobUri; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @param caching the caching value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of empty data disks in gigabytes. This element can be used to + * overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of empty data disks in gigabytes. This element can be used to + * overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @return the storageAccountType value. + */ + public StorageAccountTypes storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @param storageAccountType the storageAccountType value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withStorageAccountType(StorageAccountTypes storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed image disk. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed image disk. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the ImageDisk object itself. + */ + public ImageDisk withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDiskReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDiskReference.java new file mode 100644 index 0000000000000..6efe6d49ba499 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageDiskReference.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The source image used for creating the disk. */ +@Fluent +public final class ImageDiskReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageDiskReference.class); + + /* + * A relative uri containing either a Platform Image Repository or user + * image reference. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * If the disk is created from an image's data disk, this is an index that + * indicates which of the data disks in the image to use. For OS disks, + * this field is null. + */ + @JsonProperty(value = "lun") + private Integer lun; + + /** + * Get the id property: A relative uri containing either a Platform Image Repository or user image reference. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: A relative uri containing either a Platform Image Repository or user image reference. + * + * @param id the id value to set. + * @return the ImageDiskReference object itself. + */ + public ImageDiskReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the lun property: If the disk is created from an image's data disk, this is an index that indicates which of + * the data disks in the image to use. For OS disks, this field is null. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Set the lun property: If the disk is created from an image's data disk, this is an index that indicates which of + * the data disks in the image to use. For OS disks, this field is null. + * + * @param lun the lun value to set. + * @return the ImageDiskReference object itself. + */ + public ImageDiskReference withLun(Integer lun) { + this.lun = lun; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model ImageDiskReference")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageListResult.java new file mode 100644 index 0000000000000..e9e2d4cae788b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Image operation response. */ +@Fluent +public final class ImageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageListResult.class); + + /* + * The list of Images. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Images. Call ListNext() with this to + * fetch the next page of Images. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of Images. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Images. + * + * @param value the value value to set. + * @return the ImageListResult object itself. + */ + public ImageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Images. Call ListNext() with this to fetch the next + * page of Images. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Images. Call ListNext() with this to fetch the next + * page of Images. + * + * @param nextLink the nextLink value to set. + * @return the ImageListResult object itself. + */ + public ImageListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ImageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageOSDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageOSDisk.java new file mode 100644 index 0000000000000..cd6c68523a540 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageOSDisk.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Operating System disk. */ +@Fluent +public final class ImageOSDisk extends ImageDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageOSDisk.class); + + /* + * This property allows you to specify the type of the OS that is included + * in the disk if creating a VM from a custom image.

    Possible + * values are:

    **Windows**

    **Linux** + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemTypes osType; + + /* + * The OS State. + */ + @JsonProperty(value = "osState", required = true) + private OperatingSystemStateTypes osState; + + /** + * 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 a custom image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **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 a custom image. <br><br> Possible values are: <br><br> **Windows** + * <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the ImageOSDisk object itself. + */ + public ImageOSDisk withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the osState property: The OS State. + * + * @return the osState value. + */ + public OperatingSystemStateTypes osState() { + return this.osState; + } + + /** + * Set the osState property: The OS State. + * + * @param osState the osState value to set. + * @return the ImageOSDisk object itself. + */ + public ImageOSDisk withOsState(OperatingSystemStateTypes osState) { + this.osState = osState; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withSnapshot(SubResource snapshot) { + super.withSnapshot(snapshot); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withManagedDisk(SubResource managedDisk) { + super.withManagedDisk(managedDisk); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withBlobUri(String blobUri) { + super.withBlobUri(blobUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withCaching(CachingTypes caching) { + super.withCaching(caching); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withDiskSizeGB(Integer diskSizeGB) { + super.withDiskSizeGB(diskSizeGB); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withStorageAccountType(StorageAccountTypes storageAccountType) { + super.withStorageAccountType(storageAccountType); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageOSDisk withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + super.withDiskEncryptionSet(diskEncryptionSet); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osType in model ImageOSDisk")); + } + if (osState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osState in model ImageOSDisk")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImagePurchasePlan.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImagePurchasePlan.java new file mode 100644 index 0000000000000..0d1d8d58d7de0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImagePurchasePlan.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the gallery image definition purchase plan. This is used by marketplace images. */ +@Fluent +public final class ImagePurchasePlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImagePurchasePlan.class); + + /* + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The product ID. + */ + @JsonProperty(value = "product") + private String product; + + /** + * Get the name property: The plan ID. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan ID. + * + * @param name the name value to set. + * @return the ImagePurchasePlan object itself. + */ + public ImagePurchasePlan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher ID. + * + * @param publisher the publisher value to set. + * @return the ImagePurchasePlan object itself. + */ + public ImagePurchasePlan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The product ID. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The product ID. + * + * @param product the product value to set. + * @return the ImagePurchasePlan object itself. + */ + public ImagePurchasePlan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageReference.java new file mode 100644 index 0000000000000..7f28e4c8b7b64 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageReference.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies information about the image to use. You can specify information about platform images, marketplace images, + * or virtual machine images. This element is required when you want to use a platform image, marketplace image, or + * virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can + * only be set when you create the scale set. + */ +@Fluent +public final class ImageReference extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageReference.class); + + /* + * The image publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the offer of the platform image or marketplace image used to + * create the virtual machine. + */ + @JsonProperty(value = "offer") + private String offer; + + /* + * The image SKU. + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * Specifies the version of the platform image or marketplace image used to + * create the virtual machine. The allowed formats are Major.Minor.Build or + * 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' + * to use the latest version of an image available at deploy time. Even if + * you use 'latest', the VM image will not automatically update after + * deploy time even if a new version becomes available. + */ + @JsonProperty(value = "version") + private String version; + + /* + * Specifies in decimal numbers, the version of platform image or + * marketplace image used to create the virtual machine. This readonly + * field differs from 'version', only if the value specified in 'version' + * field is 'latest'. + */ + @JsonProperty(value = "exactVersion", access = JsonProperty.Access.WRITE_ONLY) + private String exactVersion; + + /* + * Specified the shared gallery image unique id for vm deployment. This can + * be fetched from shared gallery image GET call. + */ + @JsonProperty(value = "sharedGalleryImageId") + private String sharedGalleryImageId; + + /* + * Specified the community gallery image unique id for vm deployment. This + * can be fetched from community gallery image GET call. + */ + @JsonProperty(value = "communityGalleryImageId") + private String communityGalleryImageId; + + /** + * Get the publisher property: The image publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The image publisher. + * + * @param publisher the publisher value to set. + * @return the ImageReference object itself. + */ + public ImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: Specifies the offer of the platform image or marketplace image used to create the virtual + * machine. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: Specifies the offer of the platform image or marketplace image used to create the virtual + * machine. + * + * @param offer the offer value to set. + * @return the ImageReference object itself. + */ + public ImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: The image SKU. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The image SKU. + * + * @param sku the sku value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the version property: Specifies the version of the platform image or marketplace image used to create the + * virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal + * numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use + * 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Specifies the version of the platform image or marketplace image used to create the + * virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal + * numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use + * 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. + * + * @param version the version value to set. + * @return the ImageReference object itself. + */ + public ImageReference withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the exactVersion property: Specifies in decimal numbers, the version of platform image or marketplace image + * used to create the virtual machine. This readonly field differs from 'version', only if the value specified in + * 'version' field is 'latest'. + * + * @return the exactVersion value. + */ + public String exactVersion() { + return this.exactVersion; + } + + /** + * Get the sharedGalleryImageId property: Specified the shared gallery image unique id for vm deployment. This can + * be fetched from shared gallery image GET call. + * + * @return the sharedGalleryImageId value. + */ + public String sharedGalleryImageId() { + return this.sharedGalleryImageId; + } + + /** + * Set the sharedGalleryImageId property: Specified the shared gallery image unique id for vm deployment. This can + * be fetched from shared gallery image GET call. + * + * @param sharedGalleryImageId the sharedGalleryImageId value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSharedGalleryImageId(String sharedGalleryImageId) { + this.sharedGalleryImageId = sharedGalleryImageId; + return this; + } + + /** + * Get the communityGalleryImageId property: Specified the community gallery image unique id for vm deployment. This + * can be fetched from community gallery image GET call. + * + * @return the communityGalleryImageId value. + */ + public String communityGalleryImageId() { + return this.communityGalleryImageId; + } + + /** + * Set the communityGalleryImageId property: Specified the community gallery image unique id for vm deployment. This + * can be fetched from community gallery image GET call. + * + * @param communityGalleryImageId the communityGalleryImageId value to set. + * @return the ImageReference object itself. + */ + public ImageReference withCommunityGalleryImageId(String communityGalleryImageId) { + this.communityGalleryImageId = communityGalleryImageId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageReference withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageStorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageStorageProfile.java new file mode 100644 index 0000000000000..bd59414d7cc68 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageStorageProfile.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a storage profile. */ +@Fluent +public final class ImageStorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageStorageProfile.class); + + /* + * Specifies information about the operating system disk used by the + * virtual machine.

    For more information about disks, see [About + * disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "osDisk") + private ImageOSDisk osDisk; + + /* + * Specifies the parameters that are used to add a data disk to a virtual + * machine.

    For more information about disks, see [About disks and + * VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /* + * Specifies whether an image is zone resilient or not. Default is false. + * Zone resilient images can be created only in regions that provide Zone + * Redundant Storage (ZRS). + */ + @JsonProperty(value = "zoneResilient") + private Boolean zoneResilient; + + /** + * Get the osDisk property: Specifies information about the operating system disk used by the virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the osDisk value. + */ + public ImageOSDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: Specifies information about the operating system disk used by the virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param osDisk the osDisk value to set. + * @return the ImageStorageProfile object itself. + */ + public ImageStorageProfile withOsDisk(ImageOSDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: Specifies the parameters that are used to add a data disk to a virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Specifies the parameters that are used to add a data disk to a virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param dataDisks the dataDisks value to set. + * @return the ImageStorageProfile object itself. + */ + public ImageStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Get the zoneResilient property: Specifies whether an image is zone resilient or not. Default is false. Zone + * resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + * + * @return the zoneResilient value. + */ + public Boolean zoneResilient() { + return this.zoneResilient; + } + + /** + * Set the zoneResilient property: Specifies whether an image is zone resilient or not. Default is false. Zone + * resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + * + * @param zoneResilient the zoneResilient value to set. + * @return the ImageStorageProfile object itself. + */ + public ImageStorageProfile withZoneResilient(Boolean zoneResilient) { + this.zoneResilient = zoneResilient; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageUpdate.java new file mode 100644 index 0000000000000..d0f679895b25f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ImageUpdate.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.ImageProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The source user image virtual hard disk. Only tags may be updated. */ +@Fluent +public final class ImageUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageUpdate.class); + + /* + * Describes the properties of an Image. + */ + @JsonProperty(value = "properties") + private ImageProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of an Image. + * + * @return the innerProperties value. + */ + private ImageProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ImageUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @return the sourceVirtualMachine value. + */ + public SubResource sourceVirtualMachine() { + return this.innerProperties() == null ? null : this.innerProperties().sourceVirtualMachine(); + } + + /** + * Set the sourceVirtualMachine property: The source virtual machine from which Image is created. + * + * @param sourceVirtualMachine the sourceVirtualMachine value to set. + * @return the ImageUpdate object itself. + */ + public ImageUpdate withSourceVirtualMachine(SubResource sourceVirtualMachine) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withSourceVirtualMachine(sourceVirtualMachine); + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public ImageStorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the ImageUpdate object itself. + */ + public ImageUpdate withStorageProfile(ImageStorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the provisioningState property: The provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @return the hyperVGeneration value. + */ + public HyperVGenerationTypes hyperVGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hyperVGeneration(); + } + + /** + * Set the hyperVGeneration property: Specifies the HyperVGenerationType of the VirtualMachine created from the + * image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if + * the source is managed resource like disk or snapshot, we may require the user to specify the property if we + * cannot deduce it from the source managed resource. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the ImageUpdate object itself. + */ + public ImageUpdate withHyperVGeneration(HyperVGenerationTypes hyperVGeneration) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withHyperVGeneration(hyperVGeneration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Images.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Images.java new file mode 100644 index 0000000000000..bdafcfc2b58d6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Images.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 Images. */ +public interface Images { + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 imageName); + + /** + * Deletes an Image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 imageName, Context context); + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image. + */ + Image getByResourceGroup(String resourceGroupName, String imageName); + + /** + * Gets an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String imageName, String expand, Context context); + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the list of images under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of images under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + PagedIterable list(); + + /** + * Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of + * Images. Do this till nextLink is null to fetch all the Images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Images in the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets an image. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response}. + */ + Image getById(String id); + + /** + * Gets an image. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an image along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Deletes an Image. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 an 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.resourcemanager.compute.generated.models.ApiErrorException 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 Image resource. + * + * @param name resource name. + * @return the first stage of the new Image definition. + */ + Image.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InnerError.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InnerError.java new file mode 100644 index 0000000000000..43b775993a159 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InnerError.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Inner error details. */ +@Fluent +public final class InnerError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InnerError.class); + + /* + * The exception type. + */ + @JsonProperty(value = "exceptiontype") + private String exceptiontype; + + /* + * The internal error message or exception dump. + */ + @JsonProperty(value = "errordetail") + private String errordetail; + + /** + * Get the exceptiontype property: The exception type. + * + * @return the exceptiontype value. + */ + public String exceptiontype() { + return this.exceptiontype; + } + + /** + * Set the exceptiontype property: The exception type. + * + * @param exceptiontype the exceptiontype value to set. + * @return the InnerError object itself. + */ + public InnerError withExceptiontype(String exceptiontype) { + this.exceptiontype = exceptiontype; + return this; + } + + /** + * Get the errordetail property: The internal error message or exception dump. + * + * @return the errordetail value. + */ + public String errordetail() { + return this.errordetail; + } + + /** + * Set the errordetail property: The internal error message or exception dump. + * + * @param errordetail the errordetail value to set. + * @return the InnerError object itself. + */ + public InnerError withErrordetail(String errordetail) { + this.errordetail = errordetail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceSku.java new file mode 100644 index 0000000000000..638ff3a2d29e5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceSku.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InstanceSku model. */ +@Immutable +public final class InstanceSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceSku.class); + + /* + * The sku name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The tier of the cloud service role instance. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /** + * Get the name property: The sku name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the tier property: The tier of the cloud service role instance. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatus.java new file mode 100644 index 0000000000000..07954d8f6a982 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatus.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Instance view status. */ +@Fluent +public final class InstanceViewStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceViewStatus.class); + + /* + * The status code. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The level code. + */ + @JsonProperty(value = "level") + private StatusLevelTypes level; + + /* + * The short localizable label for the status. + */ + @JsonProperty(value = "displayStatus") + private String displayStatus; + + /* + * The detailed status message, including for alerts and error messages. + */ + @JsonProperty(value = "message") + private String message; + + /* + * The time of the status. + */ + @JsonProperty(value = "time") + private OffsetDateTime time; + + /** + * Get the code property: The status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The status code. + * + * @param code the code value to set. + * @return the InstanceViewStatus object itself. + */ + public InstanceViewStatus withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the level property: The level code. + * + * @return the level value. + */ + public StatusLevelTypes level() { + return this.level; + } + + /** + * Set the level property: The level code. + * + * @param level the level value to set. + * @return the InstanceViewStatus object itself. + */ + public InstanceViewStatus withLevel(StatusLevelTypes level) { + this.level = level; + return this; + } + + /** + * Get the displayStatus property: The short localizable label for the status. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Set the displayStatus property: The short localizable label for the status. + * + * @param displayStatus the displayStatus value to set. + * @return the InstanceViewStatus object itself. + */ + public InstanceViewStatus withDisplayStatus(String displayStatus) { + this.displayStatus = displayStatus; + return this; + } + + /** + * Get the message property: The detailed status message, including for alerts and error messages. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The detailed status message, including for alerts and error messages. + * + * @param message the message value to set. + * @return the InstanceViewStatus object itself. + */ + public InstanceViewStatus withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the time property: The time of the status. + * + * @return the time value. + */ + public OffsetDateTime time() { + return this.time; + } + + /** + * Set the time property: The time of the status. + * + * @param time the time value to set. + * @return the InstanceViewStatus object itself. + */ + public InstanceViewStatus withTime(OffsetDateTime time) { + this.time = time; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatusesSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatusesSummary.java new file mode 100644 index 0000000000000..6cf8f4da46d84 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewStatusesSummary.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Instance view statuses. */ +@Immutable +public final class InstanceViewStatusesSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstanceViewStatusesSummary.class); + + /* + * The statusesSummary property. + */ + @JsonProperty(value = "statusesSummary", access = JsonProperty.Access.WRITE_ONLY) + private List statusesSummary; + + /** + * Get the statusesSummary property: The statusesSummary property. + * + * @return the statusesSummary value. + */ + public List statusesSummary() { + return this.statusesSummary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusesSummary() != null) { + statusesSummary().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewTypes.java new file mode 100644 index 0000000000000..01344b9ee52c6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/InstanceViewTypes.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for InstanceViewTypes. */ +public enum InstanceViewTypes { + /** Enum value instanceView. */ + INSTANCE_VIEW("instanceView"), + + /** Enum value userData. */ + USER_DATA("userData"); + + /** The actual serialized value for a InstanceViewTypes instance. */ + private final String value; + + InstanceViewTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InstanceViewTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed InstanceViewTypes object, or null if unable to parse. + */ + @JsonCreator + public static InstanceViewTypes fromString(String value) { + InstanceViewTypes[] items = InstanceViewTypes.values(); + for (InstanceViewTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IntervalInMins.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IntervalInMins.java new file mode 100644 index 0000000000000..12175e15b6ac7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IntervalInMins.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IntervalInMins. */ +public enum IntervalInMins { + /** Enum value ThreeMins. */ + THREE_MINS("ThreeMins"), + + /** Enum value FiveMins. */ + FIVE_MINS("FiveMins"), + + /** Enum value ThirtyMins. */ + THIRTY_MINS("ThirtyMins"), + + /** Enum value SixtyMins. */ + SIXTY_MINS("SixtyMins"); + + /** The actual serialized value for a IntervalInMins instance. */ + private final String value; + + IntervalInMins(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IntervalInMins instance. + * + * @param value the serialized value to parse. + * @return the parsed IntervalInMins object, or null if unable to parse. + */ + @JsonCreator + public static IntervalInMins fromString(String value) { + IntervalInMins[] items = IntervalInMins.values(); + for (IntervalInMins item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersion.java new file mode 100644 index 0000000000000..2f987208d2812 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersion.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IpVersion. */ +public final class IpVersion extends ExpandableStringEnum { + /** Static value IPv4 for IpVersion. */ + public static final IpVersion IPV4 = fromString("IPv4"); + + /** Static value IPv6 for IpVersion. */ + public static final IpVersion IPV6 = fromString("IPv6"); + + /** + * Creates or finds a IpVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding IpVersion. + */ + @JsonCreator + public static IpVersion fromString(String name) { + return fromString(name, IpVersion.class); + } + + /** @return known IpVersion values. */ + public static Collection values() { + return values(IpVersion.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersions.java new file mode 100644 index 0000000000000..97520e67502bb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/IpVersions.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IpVersions. */ +public final class IpVersions extends ExpandableStringEnum { + /** Static value IPv4 for IpVersions. */ + public static final IpVersions IPV4 = fromString("IPv4"); + + /** Static value IPv6 for IpVersions. */ + public static final IpVersions IPV6 = fromString("IPv6"); + + /** + * Creates or finds a IpVersions from its string representation. + * + * @param name a name to look for. + * @return the corresponding IpVersions. + */ + @JsonCreator + public static IpVersions fromString(String name) { + return fromString(name, IpVersions.class); + } + + /** @return known IpVersions values. */ + public static Collection values() { + return values(IpVersions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyForDiskEncryptionSet.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyForDiskEncryptionSet.java new file mode 100644 index 0000000000000..23c7246a18000 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyForDiskEncryptionSet.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. */ +@Fluent +public final class KeyForDiskEncryptionSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyForDiskEncryptionSet.class); + + /* + * Resource id of the KeyVault containing the key or secret. This property + * is optional and cannot be used if the KeyVault subscription is not the + * same as the Disk Encryption Set subscription. + */ + @JsonProperty(value = "sourceVault") + private SourceVault sourceVault; + + /* + * Fully versioned Key Url pointing to a key in KeyVault. Version segment + * of the Url is required regardless of rotationToLatestKeyVersionEnabled + * value. + */ + @JsonProperty(value = "keyUrl", required = true) + private String keyUrl; + + /** + * Get the sourceVault property: Resource id of the KeyVault containing the key or secret. This property is optional + * and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. + * + * @return the sourceVault value. + */ + public SourceVault sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: Resource id of the KeyVault containing the key or secret. This property is optional + * and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyForDiskEncryptionSet object itself. + */ + public KeyForDiskEncryptionSet withSourceVault(SourceVault sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the keyUrl property: Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is + * required regardless of rotationToLatestKeyVersionEnabled value. + * + * @return the keyUrl value. + */ + public String keyUrl() { + return this.keyUrl; + } + + /** + * Set the keyUrl property: Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is + * required regardless of rotationToLatestKeyVersionEnabled value. + * + * @param keyUrl the keyUrl value to set. + * @return the KeyForDiskEncryptionSet object itself. + */ + public KeyForDiskEncryptionSet withKeyUrl(String keyUrl) { + this.keyUrl = keyUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceVault() != null) { + sourceVault().validate(); + } + if (keyUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyUrl in model KeyForDiskEncryptionSet")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndKeyReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndKeyReference.java new file mode 100644 index 0000000000000..a2c378fbe42be --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndKeyReference.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. */ +@Fluent +public final class KeyVaultAndKeyReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultAndKeyReference.class); + + /* + * Resource id of the KeyVault containing the key or secret + */ + @JsonProperty(value = "sourceVault", required = true) + private SourceVault sourceVault; + + /* + * Url pointing to a key or secret in KeyVault + */ + @JsonProperty(value = "keyUrl", required = true) + private String keyUrl; + + /** + * Get the sourceVault property: Resource id of the KeyVault containing the key or secret. + * + * @return the sourceVault value. + */ + public SourceVault sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: Resource id of the KeyVault containing the key or secret. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultAndKeyReference object itself. + */ + public KeyVaultAndKeyReference withSourceVault(SourceVault sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the keyUrl property: Url pointing to a key or secret in KeyVault. + * + * @return the keyUrl value. + */ + public String keyUrl() { + return this.keyUrl; + } + + /** + * Set the keyUrl property: Url pointing to a key or secret in KeyVault. + * + * @param keyUrl the keyUrl value to set. + * @return the KeyVaultAndKeyReference object itself. + */ + public KeyVaultAndKeyReference withKeyUrl(String keyUrl) { + this.keyUrl = keyUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceVault() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultAndKeyReference")); + } else { + sourceVault().validate(); + } + if (keyUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyUrl in model KeyVaultAndKeyReference")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndSecretReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndSecretReference.java new file mode 100644 index 0000000000000..b0748bcd1562b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultAndSecretReference.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key Vault Secret Url and vault id of the encryption key. */ +@Fluent +public final class KeyVaultAndSecretReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultAndSecretReference.class); + + /* + * Resource id of the KeyVault containing the key or secret + */ + @JsonProperty(value = "sourceVault", required = true) + private SourceVault sourceVault; + + /* + * Url pointing to a key or secret in KeyVault + */ + @JsonProperty(value = "secretUrl", required = true) + private String secretUrl; + + /** + * Get the sourceVault property: Resource id of the KeyVault containing the key or secret. + * + * @return the sourceVault value. + */ + public SourceVault sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: Resource id of the KeyVault containing the key or secret. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultAndSecretReference object itself. + */ + public KeyVaultAndSecretReference withSourceVault(SourceVault sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the secretUrl property: Url pointing to a key or secret in KeyVault. + * + * @return the secretUrl value. + */ + public String secretUrl() { + return this.secretUrl; + } + + /** + * Set the secretUrl property: Url pointing to a key or secret in KeyVault. + * + * @param secretUrl the secretUrl value to set. + * @return the KeyVaultAndSecretReference object itself. + */ + public KeyVaultAndSecretReference withSecretUrl(String secretUrl) { + this.secretUrl = secretUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceVault() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultAndSecretReference")); + } else { + sourceVault().validate(); + } + if (secretUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secretUrl in model KeyVaultAndSecretReference")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultKeyReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultKeyReference.java new file mode 100644 index 0000000000000..37bcfb38d0847 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultKeyReference.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a reference to Key Vault Key. */ +@Fluent +public final class KeyVaultKeyReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultKeyReference.class); + + /* + * The URL referencing a key encryption key in Key Vault. + */ + @JsonProperty(value = "keyUrl", required = true) + private String keyUrl; + + /* + * The relative URL of the Key Vault containing the key. + */ + @JsonProperty(value = "sourceVault", required = true) + private SubResource sourceVault; + + /** + * Get the keyUrl property: The URL referencing a key encryption key in Key Vault. + * + * @return the keyUrl value. + */ + public String keyUrl() { + return this.keyUrl; + } + + /** + * Set the keyUrl property: The URL referencing a key encryption key in Key Vault. + * + * @param keyUrl the keyUrl value to set. + * @return the KeyVaultKeyReference object itself. + */ + public KeyVaultKeyReference withKeyUrl(String keyUrl) { + this.keyUrl = keyUrl; + return this; + } + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing the key. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing the key. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultKeyReference object itself. + */ + public KeyVaultKeyReference withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyUrl in model KeyVaultKeyReference")); + } + if (sourceVault() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultKeyReference")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultSecretReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultSecretReference.java new file mode 100644 index 0000000000000..6ffd54005b5e6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/KeyVaultSecretReference.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a reference to Key Vault Secret. */ +@Fluent +public final class KeyVaultSecretReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultSecretReference.class); + + /* + * The URL referencing a secret in a Key Vault. + */ + @JsonProperty(value = "secretUrl", required = true) + private String secretUrl; + + /* + * The relative URL of the Key Vault containing the secret. + */ + @JsonProperty(value = "sourceVault", required = true) + private SubResource sourceVault; + + /** + * Get the secretUrl property: The URL referencing a secret in a Key Vault. + * + * @return the secretUrl value. + */ + public String secretUrl() { + return this.secretUrl; + } + + /** + * Set the secretUrl property: The URL referencing a secret in a Key Vault. + * + * @param secretUrl the secretUrl value to set. + * @return the KeyVaultSecretReference object itself. + */ + public KeyVaultSecretReference withSecretUrl(String secretUrl) { + this.secretUrl = secretUrl; + return this; + } + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing the secret. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing the secret. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultSecretReference object itself. + */ + public KeyVaultSecretReference withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (secretUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property secretUrl in model KeyVaultSecretReference")); + } + if (sourceVault() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultSecretReference")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LastPatchInstallationSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LastPatchInstallationSummary.java new file mode 100644 index 0000000000000..913b5dfd3b540 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LastPatchInstallationSummary.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Describes the properties of the last installed patch summary. */ +@Immutable +public final class LastPatchInstallationSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LastPatchInstallationSummary.class); + + /* + * The overall success or failure status of the operation. It remains + * "InProgress" until the operation completes. At that point it will become + * "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings." + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private PatchOperationStatus status; + + /* + * The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + */ + @JsonProperty(value = "installationActivityId", access = JsonProperty.Access.WRITE_ONLY) + private String installationActivityId; + + /* + * Describes whether the operation ran out of time before it completed all + * its intended actions + */ + @JsonProperty(value = "maintenanceWindowExceeded", access = JsonProperty.Access.WRITE_ONLY) + private Boolean maintenanceWindowExceeded; + + /* + * The number of all available patches but not going to be installed + * because it didn't match a classification or inclusion list entry. + */ + @JsonProperty(value = "notSelectedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer notSelectedPatchCount; + + /* + * The number of all available patches but excluded explicitly by a + * customer-specified exclusion list match. + */ + @JsonProperty(value = "excludedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer excludedPatchCount; + + /* + * The number of all available patches expected to be installed over the + * course of the patch installation operation. + */ + @JsonProperty(value = "pendingPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer pendingPatchCount; + + /* + * The count of patches that successfully installed. + */ + @JsonProperty(value = "installedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer installedPatchCount; + + /* + * The count of patches that failed installation. + */ + @JsonProperty(value = "failedPatchCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedPatchCount; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The UTC timestamp when the operation began. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * The errors that were encountered during execution of the operation. The + * details array contains the list of them. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Get the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + public PatchOperationStatus status() { + return this.status; + } + + /** + * Get the installationActivityId property: The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + * + * @return the installationActivityId value. + */ + public String installationActivityId() { + return this.installationActivityId; + } + + /** + * Get the maintenanceWindowExceeded property: Describes whether the operation ran out of time before it completed + * all its intended actions. + * + * @return the maintenanceWindowExceeded value. + */ + public Boolean maintenanceWindowExceeded() { + return this.maintenanceWindowExceeded; + } + + /** + * Get the notSelectedPatchCount property: The number of all available patches but not going to be installed because + * it didn't match a classification or inclusion list entry. + * + * @return the notSelectedPatchCount value. + */ + public Integer notSelectedPatchCount() { + return this.notSelectedPatchCount; + } + + /** + * Get the excludedPatchCount property: The number of all available patches but excluded explicitly by a + * customer-specified exclusion list match. + * + * @return the excludedPatchCount value. + */ + public Integer excludedPatchCount() { + return this.excludedPatchCount; + } + + /** + * Get the pendingPatchCount property: The number of all available patches expected to be installed over the course + * of the patch installation operation. + * + * @return the pendingPatchCount value. + */ + public Integer pendingPatchCount() { + return this.pendingPatchCount; + } + + /** + * Get the installedPatchCount property: The count of patches that successfully installed. + * + * @return the installedPatchCount value. + */ + public Integer installedPatchCount() { + return this.installedPatchCount; + } + + /** + * Get the failedPatchCount property: The count of patches that failed installation. + * + * @return the failedPatchCount value. + */ + public Integer failedPatchCount() { + return this.failedPatchCount; + } + + /** + * Get the startTime property: The UTC timestamp when the operation began. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the lastModifiedTime property: The UTC timestamp when the operation began. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxConfiguration.java new file mode 100644 index 0000000000000..48a92f702a359 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxConfiguration.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the Linux operating system settings on the virtual machine. <br><br>For a list of supported + * Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + */ +@Fluent +public final class LinuxConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinuxConfiguration.class); + + /* + * Specifies whether password authentication should be disabled. + */ + @JsonProperty(value = "disablePasswordAuthentication") + private Boolean disablePasswordAuthentication; + + /* + * Specifies the ssh key configuration for a Linux OS. + */ + @JsonProperty(value = "ssh") + private SshConfiguration ssh; + + /* + * Indicates whether virtual machine agent should be provisioned on the + * virtual machine.

    When this property is not specified in the + * request body, default behavior is to set it to true. This will ensure + * that VM Agent is installed on the VM so that extensions can be added to + * the VM later. + */ + @JsonProperty(value = "provisionVMAgent") + private Boolean provisionVMAgent; + + /* + * [Preview Feature] Specifies settings related to VM Guest Patching on + * Linux. + */ + @JsonProperty(value = "patchSettings") + private LinuxPatchSettings patchSettings; + + /** + * Get the disablePasswordAuthentication property: Specifies whether password authentication should be disabled. + * + * @return the disablePasswordAuthentication value. + */ + public Boolean disablePasswordAuthentication() { + return this.disablePasswordAuthentication; + } + + /** + * Set the disablePasswordAuthentication property: Specifies whether password authentication should be disabled. + * + * @param disablePasswordAuthentication the disablePasswordAuthentication value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration 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 LinuxConfiguration object itself. + */ + public LinuxConfiguration withSsh(SshConfiguration ssh) { + this.ssh = ssh; + return this; + } + + /** + * Get the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. <br><br> When this property is not specified in the request body, default behavior is to set + * it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM + * later. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. <br><br> When this property is not specified in the request body, default behavior is to set + * it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM + * later. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + * + * @return the patchSettings value. + */ + public LinuxPatchSettings patchSettings() { + return this.patchSettings; + } + + /** + * Set the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + * + * @param patchSettings the patchSettings value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withPatchSettings(LinuxPatchSettings patchSettings) { + this.patchSettings = patchSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ssh() != null) { + ssh().validate(); + } + if (patchSettings() != null) { + patchSettings().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxParameters.java new file mode 100644 index 0000000000000..025ec2540e3c5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxParameters.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Input for InstallPatches on a Linux VM, as directly received by the API. */ +@Fluent +public final class LinuxParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinuxParameters.class); + + /* + * The update classifications to select when installing patches for Linux. + */ + @JsonProperty(value = "classificationsToInclude") + private List classificationsToInclude; + + /* + * packages to include in the patch operation. Format: + * packageName_packageVersion + */ + @JsonProperty(value = "packageNameMasksToInclude") + private List packageNameMasksToInclude; + + /* + * packages to exclude in the patch operation. Format: + * packageName_packageVersion + */ + @JsonProperty(value = "packageNameMasksToExclude") + private List packageNameMasksToExclude; + + /* + * This is used as a maintenance run identifier for Auto VM Guest Patching + * in Linux. + */ + @JsonProperty(value = "maintenanceRunId") + private String maintenanceRunId; + + /** + * Get the classificationsToInclude property: The update classifications to select when installing patches for + * Linux. + * + * @return the classificationsToInclude value. + */ + public List classificationsToInclude() { + return this.classificationsToInclude; + } + + /** + * Set the classificationsToInclude property: The update classifications to select when installing patches for + * Linux. + * + * @param classificationsToInclude the classificationsToInclude value to set. + * @return the LinuxParameters object itself. + */ + public LinuxParameters withClassificationsToInclude( + List classificationsToInclude) { + this.classificationsToInclude = classificationsToInclude; + return this; + } + + /** + * Get the packageNameMasksToInclude property: packages to include in the patch operation. Format: + * packageName_packageVersion. + * + * @return the packageNameMasksToInclude value. + */ + public List packageNameMasksToInclude() { + return this.packageNameMasksToInclude; + } + + /** + * Set the packageNameMasksToInclude property: packages to include in the patch operation. Format: + * packageName_packageVersion. + * + * @param packageNameMasksToInclude the packageNameMasksToInclude value to set. + * @return the LinuxParameters object itself. + */ + public LinuxParameters withPackageNameMasksToInclude(List packageNameMasksToInclude) { + this.packageNameMasksToInclude = packageNameMasksToInclude; + return this; + } + + /** + * Get the packageNameMasksToExclude property: packages to exclude in the patch operation. Format: + * packageName_packageVersion. + * + * @return the packageNameMasksToExclude value. + */ + public List packageNameMasksToExclude() { + return this.packageNameMasksToExclude; + } + + /** + * Set the packageNameMasksToExclude property: packages to exclude in the patch operation. Format: + * packageName_packageVersion. + * + * @param packageNameMasksToExclude the packageNameMasksToExclude value to set. + * @return the LinuxParameters object itself. + */ + public LinuxParameters withPackageNameMasksToExclude(List packageNameMasksToExclude) { + this.packageNameMasksToExclude = packageNameMasksToExclude; + return this; + } + + /** + * Get the maintenanceRunId property: This is used as a maintenance run identifier for Auto VM Guest Patching in + * Linux. + * + * @return the maintenanceRunId value. + */ + public String maintenanceRunId() { + return this.maintenanceRunId; + } + + /** + * Set the maintenanceRunId property: This is used as a maintenance run identifier for Auto VM Guest Patching in + * Linux. + * + * @param maintenanceRunId the maintenanceRunId value to set. + * @return the LinuxParameters object itself. + */ + public LinuxParameters withMaintenanceRunId(String maintenanceRunId) { + this.maintenanceRunId = maintenanceRunId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchAssessmentMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchAssessmentMode.java new file mode 100644 index 0000000000000..70de3754112cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchAssessmentMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LinuxPatchAssessmentMode. */ +public final class LinuxPatchAssessmentMode extends ExpandableStringEnum { + /** Static value ImageDefault for LinuxPatchAssessmentMode. */ + public static final LinuxPatchAssessmentMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** Static value AutomaticByPlatform for LinuxPatchAssessmentMode. */ + public static final LinuxPatchAssessmentMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates or finds a LinuxPatchAssessmentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxPatchAssessmentMode. + */ + @JsonCreator + public static LinuxPatchAssessmentMode fromString(String name) { + return fromString(name, LinuxPatchAssessmentMode.class); + } + + /** @return known LinuxPatchAssessmentMode values. */ + public static Collection values() { + return values(LinuxPatchAssessmentMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchSettings.java new file mode 100644 index 0000000000000..0aa3139acdb34 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxPatchSettings.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies settings related to VM Guest Patching on Linux. */ +@Fluent +public final class LinuxPatchSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinuxPatchSettings.class); + + /* + * Specifies the mode of VM Guest Patching to IaaS virtual machine or + * virtual machines associated to virtual machine scale set with + * OrchestrationMode as Flexible.

    Possible values are:

    **ImageDefault** - The virtual machine's default patching + * configuration is used.

    **AutomaticByPlatform** - The + * virtual machine will be automatically updated by the platform. The + * property provisionVMAgent must be true + */ + @JsonProperty(value = "patchMode") + private LinuxVMGuestPatchMode patchMode; + + /* + * Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.

    Possible values are:

    **ImageDefault** - + * You control the timing of patch assessments on a virtual machine.

    **AutomaticByPlatform** - The platform will trigger periodic + * patch assessments. The property provisionVMAgent must be true. + */ + @JsonProperty(value = "assessmentMode") + private LinuxPatchAssessmentMode assessmentMode; + + /** + * Get the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines + * associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible + * values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is + * used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the + * platform. The property provisionVMAgent must be true. + * + * @return the patchMode value. + */ + public LinuxVMGuestPatchMode patchMode() { + return this.patchMode; + } + + /** + * Set the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines + * associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible + * values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is + * used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the + * platform. The property provisionVMAgent must be true. + * + * @param patchMode the patchMode value to set. + * @return the LinuxPatchSettings object itself. + */ + public LinuxPatchSettings withPatchMode(LinuxVMGuestPatchMode patchMode) { + this.patchMode = patchMode; + return this; + } + + /** + * Get the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the + * timing of patch assessments on a virtual machine. <br /><br /> **AutomaticByPlatform** - The platform + * will trigger periodic patch assessments. The property provisionVMAgent must be true. + * + * @return the assessmentMode value. + */ + public LinuxPatchAssessmentMode assessmentMode() { + return this.assessmentMode; + } + + /** + * Set the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the + * timing of patch assessments on a virtual machine. <br /><br /> **AutomaticByPlatform** - The platform + * will trigger periodic patch assessments. The property provisionVMAgent must be true. + * + * @param assessmentMode the assessmentMode value to set. + * @return the LinuxPatchSettings object itself. + */ + public LinuxPatchSettings withAssessmentMode(LinuxPatchAssessmentMode assessmentMode) { + this.assessmentMode = assessmentMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxVMGuestPatchMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxVMGuestPatchMode.java new file mode 100644 index 0000000000000..3c29c272ba9e8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LinuxVMGuestPatchMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LinuxVMGuestPatchMode. */ +public final class LinuxVMGuestPatchMode extends ExpandableStringEnum { + /** Static value ImageDefault for LinuxVMGuestPatchMode. */ + public static final LinuxVMGuestPatchMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** Static value AutomaticByPlatform for LinuxVMGuestPatchMode. */ + public static final LinuxVMGuestPatchMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates or finds a LinuxVMGuestPatchMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxVMGuestPatchMode. + */ + @JsonCreator + public static LinuxVMGuestPatchMode fromString(String name) { + return fromString(name, LinuxVMGuestPatchMode.class); + } + + /** @return known LinuxVMGuestPatchMode values. */ + public static Collection values() { + return values(LinuxVMGuestPatchMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ListUsagesResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ListUsagesResult.java new file mode 100644 index 0000000000000..b78f2b6d40edb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ListUsagesResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Usages operation response. */ +@Fluent +public final class ListUsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListUsagesResult.class); + + /* + * The list of compute resource usages. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of compute resource usage information. + * Call ListNext() with this to fetch the next page of compute resource + * usage information. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of compute resource usages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of compute resource usages. + * + * @param value the value value to set. + * @return the ListUsagesResult object itself. + */ + public ListUsagesResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of compute resource usage information. Call ListNext() + * with this to fetch the next page of compute resource usage information. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of compute resource usage information. Call ListNext() + * with this to fetch the next page of compute resource usage information. + * + * @param nextLink the nextLink value to set. + * @return the ListUsagesResult object itself. + */ + public ListUsagesResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ListUsagesResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfiguration.java new file mode 100644 index 0000000000000..3f8b1f9870319 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfiguration.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the load balancer configuration. */ +@Fluent +public final class LoadBalancerConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadBalancerConfiguration.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id") + private String id; + + /* + * The name of the Load balancer + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Properties of the load balancer configuration. + */ + @JsonProperty(value = "properties", required = true) + private LoadBalancerConfigurationProperties properties; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the LoadBalancerConfiguration object itself. + */ + public LoadBalancerConfiguration withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the Load balancer. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Load balancer. + * + * @param name the name value to set. + * @return the LoadBalancerConfiguration object itself. + */ + public LoadBalancerConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Properties of the load balancer configuration. + * + * @return the properties value. + */ + public LoadBalancerConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the load balancer configuration. + * + * @param properties the properties value to set. + * @return the LoadBalancerConfiguration object itself. + */ + public LoadBalancerConfiguration withProperties(LoadBalancerConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model LoadBalancerConfiguration")); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model LoadBalancerConfiguration")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfigurationProperties.java new file mode 100644 index 0000000000000..ddcb457755cdd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerConfigurationProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The LoadBalancerConfigurationProperties model. */ +@Fluent +public final class LoadBalancerConfigurationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadBalancerConfigurationProperties.class); + + /* + * Specifies the frontend IP to be used for the load balancer. Only IPv4 + * frontend IP address is supported. Each load balancer configuration must + * have exactly one frontend IP configuration. + */ + @JsonProperty(value = "frontendIPConfigurations", required = true) + private List frontendIpConfigurations; + + /** + * Get the frontendIpConfigurations property: Specifies the frontend IP to be used for the load balancer. Only IPv4 + * frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP + * configuration. + * + * @return the frontendIpConfigurations value. + */ + public List frontendIpConfigurations() { + return this.frontendIpConfigurations; + } + + /** + * Set the frontendIpConfigurations property: Specifies the frontend IP to be used for the load balancer. Only IPv4 + * frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP + * configuration. + * + * @param frontendIpConfigurations the frontendIpConfigurations value to set. + * @return the LoadBalancerConfigurationProperties object itself. + */ + public LoadBalancerConfigurationProperties withFrontendIpConfigurations( + List frontendIpConfigurations) { + this.frontendIpConfigurations = frontendIpConfigurations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (frontendIpConfigurations() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property frontendIpConfigurations in model" + + " LoadBalancerConfigurationProperties")); + } else { + frontendIpConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfiguration.java new file mode 100644 index 0000000000000..b19a2704f0c68 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfiguration.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LoadBalancerFrontendIpConfiguration model. */ +@Fluent +public final class LoadBalancerFrontendIpConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadBalancerFrontendIpConfiguration.class); + + /* + * The name of the resource that is unique within the set of frontend IP + * configurations used by the load balancer. This name can be used to + * access the resource. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Properties of load balancer frontend ip configuration. + */ + @JsonProperty(value = "properties", required = true) + private LoadBalancerFrontendIpConfigurationProperties properties; + + /** + * Get the name property: The name of the resource that is unique within the set of frontend IP configurations used + * by the load balancer. This name can be used to access the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource that is unique within the set of frontend IP configurations used + * by the load balancer. This name can be used to access the resource. + * + * @param name the name value to set. + * @return the LoadBalancerFrontendIpConfiguration object itself. + */ + public LoadBalancerFrontendIpConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Properties of load balancer frontend ip configuration. + * + * @return the properties value. + */ + public LoadBalancerFrontendIpConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of load balancer frontend ip configuration. + * + * @param properties the properties value to set. + * @return the LoadBalancerFrontendIpConfiguration object itself. + */ + public LoadBalancerFrontendIpConfiguration withProperties( + LoadBalancerFrontendIpConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model LoadBalancerFrontendIpConfiguration")); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model LoadBalancerFrontendIpConfiguration")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfigurationProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfigurationProperties.java new file mode 100644 index 0000000000000..2492d4233bdcd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LoadBalancerFrontendIpConfigurationProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a cloud service IP Configuration. */ +@Fluent +public final class LoadBalancerFrontendIpConfigurationProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(LoadBalancerFrontendIpConfigurationProperties.class); + + /* + * The reference to the public ip address resource. + */ + @JsonProperty(value = "publicIPAddress") + private SubResource publicIpAddress; + + /* + * The reference to the virtual network subnet resource. + */ + @JsonProperty(value = "subnet") + private SubResource subnet; + + /* + * The virtual network private IP address of the IP configuration. + */ + @JsonProperty(value = "privateIPAddress") + private String privateIpAddress; + + /** + * Get the publicIpAddress property: The reference to the public ip address resource. + * + * @return the publicIpAddress value. + */ + public SubResource publicIpAddress() { + return this.publicIpAddress; + } + + /** + * Set the publicIpAddress property: The reference to the public ip address resource. + * + * @param publicIpAddress the publicIpAddress value to set. + * @return the LoadBalancerFrontendIpConfigurationProperties object itself. + */ + public LoadBalancerFrontendIpConfigurationProperties withPublicIpAddress(SubResource publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * Get the subnet property: The reference to the virtual network subnet resource. + * + * @return the subnet value. + */ + public SubResource subnet() { + return this.subnet; + } + + /** + * Set the subnet property: The reference to the virtual network subnet resource. + * + * @param subnet the subnet value to set. + * @return the LoadBalancerFrontendIpConfigurationProperties object itself. + */ + public LoadBalancerFrontendIpConfigurationProperties withSubnet(SubResource subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the privateIpAddress property: The virtual network private IP address of the IP configuration. + * + * @return the privateIpAddress value. + */ + public String privateIpAddress() { + return this.privateIpAddress; + } + + /** + * Set the privateIpAddress property: The virtual network private IP address of the IP configuration. + * + * @param privateIpAddress the privateIpAddress value to set. + * @return the LoadBalancerFrontendIpConfigurationProperties object itself. + */ + public LoadBalancerFrontendIpConfigurationProperties withPrivateIpAddress(String privateIpAddress) { + this.privateIpAddress = privateIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalytics.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalytics.java new file mode 100644 index 0000000000000..a943f6149748a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalytics.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of LogAnalytics. */ +public interface LogAnalytics { + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + LogAnalyticsOperationResult exportRequestRateByInterval(String location, RequestRateByIntervalInput parameters); + + /** + * Export logs that show Api requests made by this subscription in the given time window to show throttling + * activities. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + LogAnalyticsOperationResult exportRequestRateByInterval( + String location, RequestRateByIntervalInput parameters, Context context); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + LogAnalyticsOperationResult exportThrottledRequests(String location, ThrottledRequestsInput parameters); + + /** + * Export logs that show total throttled Api requests for this subscription in the given time window. + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return logAnalytics operation status response. + */ + LogAnalyticsOperationResult exportThrottledRequests( + String location, ThrottledRequestsInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsInputBase.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsInputBase.java new file mode 100644 index 0000000000000..d7655d611749e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsInputBase.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Api input base class for LogAnalytics Api. */ +@Fluent +public class LogAnalyticsInputBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsInputBase.class); + + /* + * SAS Uri of the logging blob container to which LogAnalytics Api writes + * output logs to. + */ + @JsonProperty(value = "blobContainerSasUri", required = true) + private String blobContainerSasUri; + + /* + * From time of the query + */ + @JsonProperty(value = "fromTime", required = true) + private OffsetDateTime fromTime; + + /* + * To time of the query + */ + @JsonProperty(value = "toTime", required = true) + private OffsetDateTime toTime; + + /* + * Group query result by Throttle Policy applied. + */ + @JsonProperty(value = "groupByThrottlePolicy") + private Boolean groupByThrottlePolicy; + + /* + * Group query result by Operation Name. + */ + @JsonProperty(value = "groupByOperationName") + private Boolean groupByOperationName; + + /* + * Group query result by Resource Name. + */ + @JsonProperty(value = "groupByResourceName") + private Boolean groupByResourceName; + + /* + * Group query result by Client Application ID. + */ + @JsonProperty(value = "groupByClientApplicationId") + private Boolean groupByClientApplicationId; + + /* + * Group query result by User Agent. + */ + @JsonProperty(value = "groupByUserAgent") + private Boolean groupByUserAgent; + + /** + * Get the blobContainerSasUri property: SAS Uri of the logging blob container to which LogAnalytics Api writes + * output logs to. + * + * @return the blobContainerSasUri value. + */ + public String blobContainerSasUri() { + return this.blobContainerSasUri; + } + + /** + * Set the blobContainerSasUri property: SAS Uri of the logging blob container to which LogAnalytics Api writes + * output logs to. + * + * @param blobContainerSasUri the blobContainerSasUri value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withBlobContainerSasUri(String blobContainerSasUri) { + this.blobContainerSasUri = blobContainerSasUri; + return this; + } + + /** + * Get the fromTime property: From time of the query. + * + * @return the fromTime value. + */ + public OffsetDateTime fromTime() { + return this.fromTime; + } + + /** + * Set the fromTime property: From time of the query. + * + * @param fromTime the fromTime value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withFromTime(OffsetDateTime fromTime) { + this.fromTime = fromTime; + return this; + } + + /** + * Get the toTime property: To time of the query. + * + * @return the toTime value. + */ + public OffsetDateTime toTime() { + return this.toTime; + } + + /** + * Set the toTime property: To time of the query. + * + * @param toTime the toTime value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withToTime(OffsetDateTime toTime) { + this.toTime = toTime; + return this; + } + + /** + * Get the groupByThrottlePolicy property: Group query result by Throttle Policy applied. + * + * @return the groupByThrottlePolicy value. + */ + public Boolean groupByThrottlePolicy() { + return this.groupByThrottlePolicy; + } + + /** + * Set the groupByThrottlePolicy property: Group query result by Throttle Policy applied. + * + * @param groupByThrottlePolicy the groupByThrottlePolicy value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withGroupByThrottlePolicy(Boolean groupByThrottlePolicy) { + this.groupByThrottlePolicy = groupByThrottlePolicy; + return this; + } + + /** + * Get the groupByOperationName property: Group query result by Operation Name. + * + * @return the groupByOperationName value. + */ + public Boolean groupByOperationName() { + return this.groupByOperationName; + } + + /** + * Set the groupByOperationName property: Group query result by Operation Name. + * + * @param groupByOperationName the groupByOperationName value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withGroupByOperationName(Boolean groupByOperationName) { + this.groupByOperationName = groupByOperationName; + return this; + } + + /** + * Get the groupByResourceName property: Group query result by Resource Name. + * + * @return the groupByResourceName value. + */ + public Boolean groupByResourceName() { + return this.groupByResourceName; + } + + /** + * Set the groupByResourceName property: Group query result by Resource Name. + * + * @param groupByResourceName the groupByResourceName value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withGroupByResourceName(Boolean groupByResourceName) { + this.groupByResourceName = groupByResourceName; + return this; + } + + /** + * Get the groupByClientApplicationId property: Group query result by Client Application ID. + * + * @return the groupByClientApplicationId value. + */ + public Boolean groupByClientApplicationId() { + return this.groupByClientApplicationId; + } + + /** + * Set the groupByClientApplicationId property: Group query result by Client Application ID. + * + * @param groupByClientApplicationId the groupByClientApplicationId value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withGroupByClientApplicationId(Boolean groupByClientApplicationId) { + this.groupByClientApplicationId = groupByClientApplicationId; + return this; + } + + /** + * Get the groupByUserAgent property: Group query result by User Agent. + * + * @return the groupByUserAgent value. + */ + public Boolean groupByUserAgent() { + return this.groupByUserAgent; + } + + /** + * Set the groupByUserAgent property: Group query result by User Agent. + * + * @param groupByUserAgent the groupByUserAgent value to set. + * @return the LogAnalyticsInputBase object itself. + */ + public LogAnalyticsInputBase withGroupByUserAgent(Boolean groupByUserAgent) { + this.groupByUserAgent = groupByUserAgent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (blobContainerSasUri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property blobContainerSasUri in model LogAnalyticsInputBase")); + } + if (fromTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property fromTime in model LogAnalyticsInputBase")); + } + if (toTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property toTime in model LogAnalyticsInputBase")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOperationResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOperationResult.java new file mode 100644 index 0000000000000..dc382d551f861 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOperationResult.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.LogAnalyticsOperationResultInner; + +/** An immutable client-side representation of LogAnalyticsOperationResult. */ +public interface LogAnalyticsOperationResult { + /** + * Gets the properties property: LogAnalyticsOutput. + * + * @return the properties value. + */ + LogAnalyticsOutput properties(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.LogAnalyticsOperationResultInner object. + * + * @return the inner object. + */ + LogAnalyticsOperationResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOutput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOutput.java new file mode 100644 index 0000000000000..0f8cc60b4ff5b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/LogAnalyticsOutput.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** LogAnalytics output properties. */ +@Immutable +public final class LogAnalyticsOutput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsOutput.class); + + /* + * Output file Uri path to blob container. + */ + @JsonProperty(value = "output", access = JsonProperty.Access.WRITE_ONLY) + private String output; + + /** + * Get the output property: Output file Uri path to blob container. + * + * @return the output value. + */ + public String output() { + return this.output; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceOperationResultCodeTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceOperationResultCodeTypes.java new file mode 100644 index 0000000000000..ab091c460671a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceOperationResultCodeTypes.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for MaintenanceOperationResultCodeTypes. */ +public enum MaintenanceOperationResultCodeTypes { + /** Enum value None. */ + NONE("None"), + + /** Enum value RetryLater. */ + RETRY_LATER("RetryLater"), + + /** Enum value MaintenanceAborted. */ + MAINTENANCE_ABORTED("MaintenanceAborted"), + + /** Enum value MaintenanceCompleted. */ + MAINTENANCE_COMPLETED("MaintenanceCompleted"); + + /** The actual serialized value for a MaintenanceOperationResultCodeTypes instance. */ + private final String value; + + MaintenanceOperationResultCodeTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MaintenanceOperationResultCodeTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed MaintenanceOperationResultCodeTypes object, or null if unable to parse. + */ + @JsonCreator + public static MaintenanceOperationResultCodeTypes fromString(String value) { + MaintenanceOperationResultCodeTypes[] items = MaintenanceOperationResultCodeTypes.values(); + for (MaintenanceOperationResultCodeTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceRedeployStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceRedeployStatus.java new file mode 100644 index 0000000000000..107a5d84c8ef2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/MaintenanceRedeployStatus.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Maintenance Operation Status. */ +@Fluent +public final class MaintenanceRedeployStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MaintenanceRedeployStatus.class); + + /* + * True, if customer is allowed to perform Maintenance. + */ + @JsonProperty(value = "isCustomerInitiatedMaintenanceAllowed") + private Boolean isCustomerInitiatedMaintenanceAllowed; + + /* + * Start Time for the Pre Maintenance Window. + */ + @JsonProperty(value = "preMaintenanceWindowStartTime") + private OffsetDateTime preMaintenanceWindowStartTime; + + /* + * End Time for the Pre Maintenance Window. + */ + @JsonProperty(value = "preMaintenanceWindowEndTime") + private OffsetDateTime preMaintenanceWindowEndTime; + + /* + * Start Time for the Maintenance Window. + */ + @JsonProperty(value = "maintenanceWindowStartTime") + private OffsetDateTime maintenanceWindowStartTime; + + /* + * End Time for the Maintenance Window. + */ + @JsonProperty(value = "maintenanceWindowEndTime") + private OffsetDateTime maintenanceWindowEndTime; + + /* + * The Last Maintenance Operation Result Code. + */ + @JsonProperty(value = "lastOperationResultCode") + private MaintenanceOperationResultCodeTypes lastOperationResultCode; + + /* + * Message returned for the last Maintenance Operation. + */ + @JsonProperty(value = "lastOperationMessage") + private String lastOperationMessage; + + /** + * Get the isCustomerInitiatedMaintenanceAllowed property: True, if customer is allowed to perform Maintenance. + * + * @return the isCustomerInitiatedMaintenanceAllowed value. + */ + public Boolean isCustomerInitiatedMaintenanceAllowed() { + return this.isCustomerInitiatedMaintenanceAllowed; + } + + /** + * Set the isCustomerInitiatedMaintenanceAllowed property: True, if customer is allowed to perform Maintenance. + * + * @param isCustomerInitiatedMaintenanceAllowed the isCustomerInitiatedMaintenanceAllowed value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withIsCustomerInitiatedMaintenanceAllowed( + Boolean isCustomerInitiatedMaintenanceAllowed) { + this.isCustomerInitiatedMaintenanceAllowed = isCustomerInitiatedMaintenanceAllowed; + return this; + } + + /** + * Get the preMaintenanceWindowStartTime property: Start Time for the Pre Maintenance Window. + * + * @return the preMaintenanceWindowStartTime value. + */ + public OffsetDateTime preMaintenanceWindowStartTime() { + return this.preMaintenanceWindowStartTime; + } + + /** + * Set the preMaintenanceWindowStartTime property: Start Time for the Pre Maintenance Window. + * + * @param preMaintenanceWindowStartTime the preMaintenanceWindowStartTime value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withPreMaintenanceWindowStartTime(OffsetDateTime preMaintenanceWindowStartTime) { + this.preMaintenanceWindowStartTime = preMaintenanceWindowStartTime; + return this; + } + + /** + * Get the preMaintenanceWindowEndTime property: End Time for the Pre Maintenance Window. + * + * @return the preMaintenanceWindowEndTime value. + */ + public OffsetDateTime preMaintenanceWindowEndTime() { + return this.preMaintenanceWindowEndTime; + } + + /** + * Set the preMaintenanceWindowEndTime property: End Time for the Pre Maintenance Window. + * + * @param preMaintenanceWindowEndTime the preMaintenanceWindowEndTime value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withPreMaintenanceWindowEndTime(OffsetDateTime preMaintenanceWindowEndTime) { + this.preMaintenanceWindowEndTime = preMaintenanceWindowEndTime; + return this; + } + + /** + * Get the maintenanceWindowStartTime property: Start Time for the Maintenance Window. + * + * @return the maintenanceWindowStartTime value. + */ + public OffsetDateTime maintenanceWindowStartTime() { + return this.maintenanceWindowStartTime; + } + + /** + * Set the maintenanceWindowStartTime property: Start Time for the Maintenance Window. + * + * @param maintenanceWindowStartTime the maintenanceWindowStartTime value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withMaintenanceWindowStartTime(OffsetDateTime maintenanceWindowStartTime) { + this.maintenanceWindowStartTime = maintenanceWindowStartTime; + return this; + } + + /** + * Get the maintenanceWindowEndTime property: End Time for the Maintenance Window. + * + * @return the maintenanceWindowEndTime value. + */ + public OffsetDateTime maintenanceWindowEndTime() { + return this.maintenanceWindowEndTime; + } + + /** + * Set the maintenanceWindowEndTime property: End Time for the Maintenance Window. + * + * @param maintenanceWindowEndTime the maintenanceWindowEndTime value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withMaintenanceWindowEndTime(OffsetDateTime maintenanceWindowEndTime) { + this.maintenanceWindowEndTime = maintenanceWindowEndTime; + return this; + } + + /** + * Get the lastOperationResultCode property: The Last Maintenance Operation Result Code. + * + * @return the lastOperationResultCode value. + */ + public MaintenanceOperationResultCodeTypes lastOperationResultCode() { + return this.lastOperationResultCode; + } + + /** + * Set the lastOperationResultCode property: The Last Maintenance Operation Result Code. + * + * @param lastOperationResultCode the lastOperationResultCode value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withLastOperationResultCode( + MaintenanceOperationResultCodeTypes lastOperationResultCode) { + this.lastOperationResultCode = lastOperationResultCode; + return this; + } + + /** + * Get the lastOperationMessage property: Message returned for the last Maintenance Operation. + * + * @return the lastOperationMessage value. + */ + public String lastOperationMessage() { + return this.lastOperationMessage; + } + + /** + * Set the lastOperationMessage property: Message returned for the last Maintenance Operation. + * + * @param lastOperationMessage the lastOperationMessage value to set. + * @return the MaintenanceRedeployStatus object itself. + */ + public MaintenanceRedeployStatus withLastOperationMessage(String lastOperationMessage) { + this.lastOperationMessage = lastOperationMessage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ManagedDiskParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ManagedDiskParameters.java new file mode 100644 index 0000000000000..df5036a81da35 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ManagedDiskParameters.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters of a managed disk. */ +@Fluent +public final class ManagedDiskParameters extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedDiskParameters.class); + + /* + * Specifies the storage account type for the managed disk. NOTE: + * UltraSSD_LRS can only be used with data disks, it cannot be used with OS + * Disk. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountTypes storageAccountType; + + /* + * Specifies the customer managed disk encryption set resource id for the + * managed disk. + */ + @JsonProperty(value = "diskEncryptionSet") + private DiskEncryptionSetParameters diskEncryptionSet; + + /* + * Specifies the security profile for the managed disk. + */ + @JsonProperty(value = "securityProfile") + private VMDiskSecurityProfile securityProfile; + + /** + * Get the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @return the storageAccountType value. + */ + public StorageAccountTypes storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @param storageAccountType the storageAccountType value to set. + * @return the ManagedDiskParameters object itself. + */ + public ManagedDiskParameters withStorageAccountType(StorageAccountTypes storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the ManagedDiskParameters object itself. + */ + public ManagedDiskParameters withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * 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 ManagedDiskParameters object itself. + */ + public ManagedDiskParameters withSecurityProfile(VMDiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedDiskParameters withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkAccessPolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkAccessPolicy.java new file mode 100644 index 0000000000000..791f3b3935990 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkAccessPolicy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkAccessPolicy. */ +public final class NetworkAccessPolicy extends ExpandableStringEnum { + /** Static value AllowAll for NetworkAccessPolicy. */ + public static final NetworkAccessPolicy ALLOW_ALL = fromString("AllowAll"); + + /** Static value AllowPrivate for NetworkAccessPolicy. */ + public static final NetworkAccessPolicy ALLOW_PRIVATE = fromString("AllowPrivate"); + + /** Static value DenyAll for NetworkAccessPolicy. */ + public static final NetworkAccessPolicy DENY_ALL = fromString("DenyAll"); + + /** + * Creates or finds a NetworkAccessPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkAccessPolicy. + */ + @JsonCreator + public static NetworkAccessPolicy fromString(String name) { + return fromString(name, NetworkAccessPolicy.class); + } + + /** @return known NetworkAccessPolicy values. */ + public static Collection values() { + return values(NetworkAccessPolicy.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkApiVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkApiVersion.java new file mode 100644 index 0000000000000..4a1a236fde33c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkApiVersion.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkApiVersion. */ +public final class NetworkApiVersion extends ExpandableStringEnum { + /** Static value 2020-11-01 for NetworkApiVersion. */ + public static final NetworkApiVersion TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE = fromString("2020-11-01"); + + /** + * Creates or finds a NetworkApiVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkApiVersion. + */ + @JsonCreator + public static NetworkApiVersion fromString(String name) { + return fromString(name, NetworkApiVersion.class); + } + + /** @return known NetworkApiVersion values. */ + public static Collection values() { + return values(NetworkApiVersion.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkInterfaceReference.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkInterfaceReference.java new file mode 100644 index 0000000000000..22e80847f81be --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkInterfaceReference.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.NetworkInterfaceReferenceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a network interface reference. */ +@Fluent +public final class NetworkInterfaceReference extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkInterfaceReference.class); + + /* + * Describes a network interface reference properties. + */ + @JsonProperty(value = "properties") + private NetworkInterfaceReferenceProperties innerProperties; + + /** + * Get the innerProperties property: Describes a network interface reference properties. + * + * @return the innerProperties value. + */ + private NetworkInterfaceReferenceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public NetworkInterfaceReference withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the NetworkInterfaceReference object itself. + */ + public NetworkInterfaceReference withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkInterfaceReferenceProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the NetworkInterfaceReference object itself. + */ + public NetworkInterfaceReference withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkInterfaceReferenceProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkProfile.java new file mode 100644 index 0000000000000..8eeb7ab36bd63 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/NetworkProfile.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the network interfaces or the networking configuration of the virtual machine. */ +@Fluent +public final class NetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkProfile.class); + + /* + * Specifies the list of resource Ids for the network interfaces associated + * with the virtual machine. + */ + @JsonProperty(value = "networkInterfaces") + private List networkInterfaces; + + /* + * specifies the Microsoft.Network API version used when creating + * networking resources in the Network Interface Configurations + */ + @JsonProperty(value = "networkApiVersion") + private NetworkApiVersion networkApiVersion; + + /* + * Specifies the networking configurations that will be used to create the + * virtual machine networking resources. + */ + @JsonProperty(value = "networkInterfaceConfigurations") + private List networkInterfaceConfigurations; + + /** + * Get the networkInterfaces property: Specifies the list of resource Ids for the network interfaces associated with + * the virtual machine. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: Specifies the list of resource Ids for the network interfaces associated with + * the virtual machine. + * + * @param networkInterfaces the networkInterfaces value to set. + * @return the NetworkProfile object itself. + */ + public NetworkProfile withNetworkInterfaces(List networkInterfaces) { + this.networkInterfaces = networkInterfaces; + return this; + } + + /** + * Get the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations. + * + * @return the networkApiVersion value. + */ + public NetworkApiVersion networkApiVersion() { + return this.networkApiVersion; + } + + /** + * Set the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations. + * + * @param networkApiVersion the networkApiVersion value to set. + * @return the NetworkProfile object itself. + */ + public NetworkProfile withNetworkApiVersion(NetworkApiVersion networkApiVersion) { + this.networkApiVersion = networkApiVersion; + return this; + } + + /** + * Get the networkInterfaceConfigurations property: Specifies the networking configurations that will be used to + * create the virtual machine networking resources. + * + * @return the networkInterfaceConfigurations value. + */ + public List networkInterfaceConfigurations() { + return this.networkInterfaceConfigurations; + } + + /** + * Set the networkInterfaceConfigurations property: Specifies the networking configurations that will be used to + * create the virtual machine networking resources. + * + * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set. + * @return the NetworkProfile object itself. + */ + public NetworkProfile withNetworkInterfaceConfigurations( + List networkInterfaceConfigurations) { + this.networkInterfaceConfigurations = networkInterfaceConfigurations; + 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()); + } + if (networkInterfaceConfigurations() != null) { + networkInterfaceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDisk.java new file mode 100644 index 0000000000000..5544175ff95b0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDisk.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies information about the operating system disk used by the virtual machine. <br><br> For more + * information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ +@Fluent +public final class OSDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSDisk.class); + + /* + * 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** + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * Specifies the encryption settings for the OS Disk.

    Minimum + * api-version: 2015-06-15 + */ + @JsonProperty(value = "encryptionSettings") + private DiskEncryptionSettings encryptionSettings; + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The virtual hard disk. + */ + @JsonProperty(value = "vhd") + private VirtualHardDisk vhd; + + /* + * The source user image virtual hard disk. The virtual hard disk will be + * copied before being attached to the virtual machine. If SourceImage is + * provided, the destination virtual hard drive must not exist. + */ + @JsonProperty(value = "image") + private VirtualHardDisk image; + + /* + * Specifies the caching requirements.

    Possible values are: + *

    **None**

    **ReadOnly**

    **ReadWrite**

    + * Default: **None** for Standard storage. **ReadOnly** for Premium + * storage. + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + */ + @JsonProperty(value = "writeAcceleratorEnabled") + private Boolean writeAcceleratorEnabled; + + /* + * Specifies the ephemeral Disk Settings for the operating system disk used + * by the virtual machine. + */ + @JsonProperty(value = "diffDiskSettings") + private DiffDiskSettings diffDiskSettings; + + /* + * Specifies how the virtual machine should be created.

    Possible + * values are:

    **Attach** \u2013 This value is used when you are + * using a specialized disk to create the virtual machine.

    + * **FromImage** \u2013 This value is used when you are using an image to + * create the virtual machine. If you are using a platform image, you also + * use the imageReference element described above. If you are using a + * marketplace image, you also use the plan element previously described. + */ + @JsonProperty(value = "createOption", required = true) + private DiskCreateOptionTypes createOption; + + /* + * Specifies the size of an empty data disk in gigabytes. This element can + * be used to overwrite the size of the disk in a virtual machine image. + *

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The managed disk parameters. + */ + @JsonProperty(value = "managedDisk") + private ManagedDiskParameters managedDisk; + + /* + * Specifies whether OS Disk should be deleted or detached upon VM + * deletion.

    Possible values:

    **Delete** If this value is + * used, the OS disk is deleted when VM is deleted.

    **Detach** If + * this value is used, the os disk is retained after VM is deleted. + *

    The default value is set to **detach**. For an ephemeral OS + * Disk, the default value is set to **Delete**. User cannot change the + * delete option for ephemeral OS Disk. + */ + @JsonProperty(value = "deleteOption") + private DiskDeleteOptionTypes deleteOption; + + /** + * 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. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **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. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the OSDisk object itself. + */ + public OSDisk withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the encryptionSettings value. + */ + public DiskEncryptionSettings encryptionSettings() { + return this.encryptionSettings; + } + + /** + * Set the encryptionSettings property: Specifies the encryption settings for the OS Disk. <br><br> + * Minimum api-version: 2015-06-15. + * + * @param encryptionSettings the encryptionSettings value to set. + * @return the OSDisk object itself. + */ + public OSDisk withEncryptionSettings(DiskEncryptionSettings encryptionSettings) { + this.encryptionSettings = encryptionSettings; + return this; + } + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the OSDisk object itself. + */ + public OSDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the vhd property: The virtual hard disk. + * + * @return the vhd value. + */ + public VirtualHardDisk vhd() { + return this.vhd; + } + + /** + * Set the vhd property: The virtual hard disk. + * + * @param vhd the vhd value to set. + * @return the OSDisk object itself. + */ + public OSDisk withVhd(VirtualHardDisk vhd) { + this.vhd = vhd; + return this; + } + + /** + * Get the image property: The source user image virtual hard disk. The virtual hard disk will be copied before + * being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not + * exist. + * + * @return the image value. + */ + public VirtualHardDisk image() { + return this.image; + } + + /** + * Set the image property: The source user image virtual hard disk. The virtual hard disk will be copied before + * being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not + * exist. + * + * @param image the image value to set. + * @return the OSDisk object itself. + */ + public OSDisk withImage(VirtualHardDisk image) { + this.image = image; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None** for Standard storage. **ReadOnly** for Premium storage. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None** for Standard storage. **ReadOnly** for Premium storage. + * + * @param caching the caching value to set. + * @return the OSDisk object itself. + */ + public OSDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the OSDisk object itself. + */ + public OSDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the diffDiskSettings property: Specifies the ephemeral Disk Settings for the operating system disk used by + * the virtual machine. + * + * @return the diffDiskSettings value. + */ + public DiffDiskSettings diffDiskSettings() { + return this.diffDiskSettings; + } + + /** + * Set the diffDiskSettings property: Specifies the ephemeral Disk Settings for the operating system disk used by + * the virtual machine. + * + * @param diffDiskSettings the diffDiskSettings value to set. + * @return the OSDisk object itself. + */ + public OSDisk withDiffDiskSettings(DiffDiskSettings diffDiskSettings) { + this.diffDiskSettings = diffDiskSettings; + return this; + } + + /** + * Get the createOption property: Specifies how the virtual machine should be created.<br><br> Possible + * values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to + * create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an + * image to create the virtual machine. If you are using a platform image, you also use the imageReference element + * described above. If you are using a marketplace image, you also use the plan element previously described. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: Specifies how the virtual machine should be created.<br><br> Possible + * values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to + * create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an + * image to create the virtual machine. If you are using a platform image, you also use the imageReference element + * described above. If you are using a marketplace image, you also use the plan element previously described. + * + * @param createOption the createOption value to set. + * @return the OSDisk object itself. + */ + public OSDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the OSDisk object itself. + */ + public OSDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public ManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the OSDisk object itself. + */ + public OSDisk withManagedDisk(ManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VM deletion. + * <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is + * deleted when VM is deleted.<br><br> **Detach** If this value is used, the os disk is retained after + * VM is deleted. <br><br> The default value is set to **detach**. For an ephemeral OS Disk, the default + * value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk. + * + * @return the deleteOption value. + */ + public DiskDeleteOptionTypes deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VM deletion. + * <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is + * deleted when VM is deleted.<br><br> **Detach** If this value is used, the os disk is retained after + * VM is deleted. <br><br> The default value is set to **detach**. For an ephemeral OS Disk, the default + * value is set to **Delete**. User cannot change the delete option for ephemeral OS Disk. + * + * @param deleteOption the deleteOption value to set. + * @return the OSDisk object itself. + */ + public OSDisk withDeleteOption(DiskDeleteOptionTypes deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettings() != null) { + encryptionSettings().validate(); + } + if (vhd() != null) { + vhd().validate(); + } + if (image() != null) { + image().validate(); + } + if (diffDiskSettings() != null) { + diffDiskSettings().validate(); + } + if (createOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property createOption in model OSDisk")); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImage.java new file mode 100644 index 0000000000000..5237cdadc63cd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImage.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the os disk image information. */ +@Fluent +public final class OSDiskImage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSDiskImage.class); + + /* + * The operating system of the osDiskImage. + */ + @JsonProperty(value = "operatingSystem", required = true) + private OperatingSystemTypes operatingSystem; + + /** + * Get the operatingSystem property: The operating system of the osDiskImage. + * + * @return the operatingSystem value. + */ + public OperatingSystemTypes operatingSystem() { + return this.operatingSystem; + } + + /** + * Set the operatingSystem property: The operating system of the osDiskImage. + * + * @param operatingSystem the operatingSystem value to set. + * @return the OSDiskImage object itself. + */ + public OSDiskImage withOperatingSystem(OperatingSystemTypes operatingSystem) { + this.operatingSystem = operatingSystem; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operatingSystem() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property operatingSystem in model OSDiskImage")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImageEncryption.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImageEncryption.java new file mode 100644 index 0000000000000..15af1fdc6d4a3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSDiskImageEncryption.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Contains encryption settings for an OS disk image. */ +@Fluent +public final class OSDiskImageEncryption extends DiskImageEncryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSDiskImageEncryption.class); + + /** {@inheritDoc} */ + @Override + public OSDiskImageEncryption withDiskEncryptionSetId(String diskEncryptionSetId) { + super.withDiskEncryptionSetId(diskEncryptionSetId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamily.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamily.java new file mode 100644 index 0000000000000..2ea532fe1585b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamily.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner; + +/** An immutable client-side representation of OSFamily. */ +public interface OSFamily { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the properties property: OS family properties. + * + * @return the properties value. + */ + OSFamilyProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner object. + * + * @return the inner object. + */ + OSFamilyInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyListResult.java new file mode 100644 index 0000000000000..c397684f2444e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.OSFamilyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The OSFamilyListResult model. */ +@Fluent +public final class OSFamilyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSFamilyListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the OSFamilyListResult object itself. + */ + public OSFamilyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the OSFamilyListResult object itself. + */ + public OSFamilyListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model OSFamilyListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyProperties.java new file mode 100644 index 0000000000000..11c14d8ca4b08 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSFamilyProperties.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** OS family properties. */ +@Immutable +public final class OSFamilyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSFamilyProperties.class); + + /* + * The OS family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The OS family label. + */ + @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + private String label; + + /* + * List of OS versions belonging to this family. + */ + @JsonProperty(value = "versions", access = JsonProperty.Access.WRITE_ONLY) + private List versions; + + /** + * Get the name property: The OS family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the label property: The OS family label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Get the versions property: List of OS versions belonging to this family. + * + * @return the versions value. + */ + public List versions() { + return this.versions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (versions() != null) { + versions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSProfile.java new file mode 100644 index 0000000000000..93dcb22c55638 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSProfile.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is + * provisioned. + */ +@Fluent +public final class OSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfile.class); + + /* + * Specifies the host OS name of the virtual machine.

    This name + * cannot be updated after the VM is created.

    **Max-length + * (Windows):** 15 characters

    **Max-length (Linux):** 64 + * characters.

    For naming conventions and restrictions see [Azure + * infrastructure services implementation + * guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). + */ + @JsonProperty(value = "computerName") + private String computerName; + + /* + * Specifies the name of the administrator account.

    This property + * cannot be updated after the VM is created.

    **Windows-only + * restriction:** Cannot end in "."

    **Disallowed values:** + * "administrator", "admin", "user", "user1", "test", "user2", "test1", + * "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + * "aspnet", "backup", "console", "david", "guest", "john", "owner", + * "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + * "test3", "user4", "user5".

    **Minimum-length (Linux):** 1 + * character

    **Max-length (Linux):** 64 characters

    + * **Max-length (Windows):** 20 characters. + */ + @JsonProperty(value = "adminUsername") + private String adminUsername; + + /* + * Specifies the password of the administrator account.

    + * **Minimum-length (Windows):** 8 characters

    **Minimum-length + * (Linux):** 6 characters

    **Max-length (Windows):** 123 + * characters

    **Max-length (Linux):** 72 characters

    + * **Complexity requirements:** 3 out of 4 conditions below need to be + * fulfilled
    Has lower characters
    Has upper characters
    Has a + * digit
    Has a special character (Regex match [\W_])

    + * **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", + * "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", + * "iloveyou!"

    For resetting the password, see [How to reset the + * Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + *

    For resetting root password, see [Manage users, SSH, and check + * or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + */ + @JsonProperty(value = "adminPassword") + private String adminPassword; + + /* + * Specifies a base-64 encoded string of custom data. The base-64 encoded + * string is decoded to a binary array that is saved as a file on the + * Virtual Machine. The maximum length of the binary array is 65535 bytes. + *

    **Note: Do not pass any secrets or passwords in customData + * property**

    This property cannot be updated after the VM is + * created.

    customData is passed to the VM to be saved as a file, + * for more information see [Custom Data on Azure + * VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/) + *

    For using cloud-init for your Linux VM, see [Using cloud-init + * to customize a Linux VM during + * creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + */ + @JsonProperty(value = "customData") + private String customData; + + /* + * Specifies Windows operating system settings on the virtual machine. + */ + @JsonProperty(value = "windowsConfiguration") + private WindowsConfiguration windowsConfiguration; + + /* + * Specifies the Linux operating system settings on the virtual machine. + *

    For a list of supported Linux distributions, see [Linux on + * Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + */ + @JsonProperty(value = "linuxConfiguration") + private LinuxConfiguration linuxConfiguration; + + /* + * Specifies set of certificates that should be installed onto the virtual + * machine. To install certificates on a virtual machine it is recommended + * to use the [Azure Key Vault virtual machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + @JsonProperty(value = "secrets") + private List secrets; + + /* + * Specifies whether extension operations should be allowed on the virtual + * machine.

    This may only be set to False when no extensions are + * present on the virtual machine. + */ + @JsonProperty(value = "allowExtensionOperations") + private Boolean allowExtensionOperations; + + /* + * Specifies whether the guest provision signal is required to infer + * provision success of the virtual machine. **Note: This property is for + * private testing only, and all customers must not set the property to + * false.** + */ + @JsonProperty(value = "requireGuestProvisionSignal") + private Boolean requireGuestProvisionSignal; + + /** + * Get the computerName property: Specifies the host OS name of the virtual machine. <br><br> This name + * cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters + * <br><br> **Max-length (Linux):** 64 characters. <br><br> For naming conventions and + * restrictions see [Azure infrastructure services implementation + * guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: Specifies the host OS name of the virtual machine. <br><br> This name + * cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters + * <br><br> **Max-length (Linux):** 64 characters. <br><br> For naming conventions and + * restrictions see [Azure infrastructure services implementation + * guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). + * + * @param computerName the computerName value to set. + * @return the OSProfile object itself. + */ + public OSProfile withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the adminUsername property: Specifies the name of the administrator account. <br><br> This + * property cannot be updated after the VM is created. <br><br> **Windows-only restriction:** Cannot end + * in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", + * "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", + * "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", + * "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length + * (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. + * + * @return the adminUsername value. + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the adminUsername property: Specifies the name of the administrator account. <br><br> This + * property cannot be updated after the VM is created. <br><br> **Windows-only restriction:** Cannot end + * in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", + * "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", + * "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", + * "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length + * (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. + * + * @param adminUsername the adminUsername value to set. + * @return the OSProfile object itself. + */ + public OSProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 + * characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled + * <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special + * character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> + * For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting + * root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 + * characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled + * <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special + * character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> + * For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting + * root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @param adminPassword the adminPassword value to set. + * @return the OSProfile object itself. + */ + public OSProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string is + * decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array + * is 65535 bytes. <br><br> **Note: Do not pass any secrets or passwords in customData property** + * <br><br> This property cannot be updated after the VM is created. <br><br> customData is + * passed to the VM to be saved as a file, for more information see [Custom Data on Azure + * VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/) <br><br> For + * using cloud-init for your Linux VM, see [Using cloud-init to customize a Linux VM during + * creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @return the customData value. + */ + public String customData() { + return this.customData; + } + + /** + * Set the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string is + * decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array + * is 65535 bytes. <br><br> **Note: Do not pass any secrets or passwords in customData property** + * <br><br> This property cannot be updated after the VM is created. <br><br> customData is + * passed to the VM to be saved as a file, for more information see [Custom Data on Azure + * VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/) <br><br> For + * using cloud-init for your Linux VM, see [Using cloud-init to customize a Linux VM during + * creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @param customData the customData value to set. + * @return the OSProfile object itself. + */ + public OSProfile withCustomData(String customData) { + this.customData = customData; + return this; + } + + /** + * Get the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @return the windowsConfiguration value. + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the OSProfile object itself. + */ + public OSProfile withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. + * <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @return the linuxConfiguration value. + */ + public LinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. + * <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the OSProfile object itself. + */ + public OSProfile withLinuxConfiguration(LinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the secrets property: Specifies set of certificates that should be installed onto the virtual machine. To + * install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension + * for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: Specifies set of certificates that should be installed onto the virtual machine. To + * install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension + * for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param secrets the secrets value to set. + * @return the OSProfile object itself. + */ + public OSProfile withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Get the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine. <br><br>This may only be set to False when no extensions are present on the virtual + * machine. + * + * @return the allowExtensionOperations value. + */ + public Boolean allowExtensionOperations() { + return this.allowExtensionOperations; + } + + /** + * Set the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine. <br><br>This may only be set to False when no extensions are present on the virtual + * machine. + * + * @param allowExtensionOperations the allowExtensionOperations value to set. + * @return the OSProfile object itself. + */ + public OSProfile withAllowExtensionOperations(Boolean allowExtensionOperations) { + this.allowExtensionOperations = allowExtensionOperations; + return this; + } + + /** + * Get the requireGuestProvisionSignal property: Specifies whether the guest provision signal is required to infer + * provision success of the virtual machine. **Note: This property is for private testing only, and all customers + * must not set the property to false.**. + * + * @return the requireGuestProvisionSignal value. + */ + public Boolean requireGuestProvisionSignal() { + return this.requireGuestProvisionSignal; + } + + /** + * Set the requireGuestProvisionSignal property: Specifies whether the guest provision signal is required to infer + * provision success of the virtual machine. **Note: This property is for private testing only, and all customers + * must not set the property to false.**. + * + * @param requireGuestProvisionSignal the requireGuestProvisionSignal value to set. + * @return the OSProfile object itself. + */ + public OSProfile withRequireGuestProvisionSignal(Boolean requireGuestProvisionSignal) { + this.requireGuestProvisionSignal = requireGuestProvisionSignal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (secrets() != null) { + secrets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersion.java new file mode 100644 index 0000000000000..b423efad99d64 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersion.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; + +/** An immutable client-side representation of OSVersion. */ +public interface OSVersion { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the properties property: OS version properties. + * + * @return the properties value. + */ + OSVersionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner object. + * + * @return the inner object. + */ + OSVersionInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionListResult.java new file mode 100644 index 0000000000000..2cff82e297f98 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.OSVersionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The OSVersionListResult model. */ +@Fluent +public final class OSVersionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSVersionListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the OSVersionListResult object itself. + */ + public OSVersionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the OSVersionListResult object itself. + */ + public OSVersionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model OSVersionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionProperties.java new file mode 100644 index 0000000000000..3375abb3f2086 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** OS version properties. */ +@Immutable +public final class OSVersionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSVersionProperties.class); + + /* + * The family of this OS version. + */ + @JsonProperty(value = "family", access = JsonProperty.Access.WRITE_ONLY) + private String family; + + /* + * The family label of this OS version. + */ + @JsonProperty(value = "familyLabel", access = JsonProperty.Access.WRITE_ONLY) + private String familyLabel; + + /* + * The OS version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The OS version label. + */ + @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + private String label; + + /* + * Specifies whether this is the default OS version for its family. + */ + @JsonProperty(value = "isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /* + * Specifies whether this OS version is active. + */ + @JsonProperty(value = "isActive", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActive; + + /** + * Get the family property: The family of this OS version. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Get the familyLabel property: The family label of this OS version. + * + * @return the familyLabel value. + */ + public String familyLabel() { + return this.familyLabel; + } + + /** + * Get the version property: The OS version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the label property: The OS version label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Get the isDefault property: Specifies whether this is the default OS version for its family. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get the isActive property: Specifies whether this OS version is active. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionPropertiesBase.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionPropertiesBase.java new file mode 100644 index 0000000000000..b9e28955473fa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OSVersionPropertiesBase.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration view of an OS version. */ +@Immutable +public final class OSVersionPropertiesBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSVersionPropertiesBase.class); + + /* + * The OS version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The OS version label. + */ + @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + private String label; + + /* + * Specifies whether this is the default OS version for its family. + */ + @JsonProperty(value = "isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /* + * Specifies whether this OS version is active. + */ + @JsonProperty(value = "isActive", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActive; + + /** + * Get the version property: The OS version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the label property: The OS version label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Get the isDefault property: Specifies whether this is the default OS version for its family. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get the isActive property: Specifies whether this OS version is active. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemStateTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemStateTypes.java new file mode 100644 index 0000000000000..5d51e3c27eec0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemStateTypes.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for OperatingSystemStateTypes. */ +public enum OperatingSystemStateTypes { + /** Enum value Generalized. */ + GENERALIZED("Generalized"), + + /** Enum value Specialized. */ + SPECIALIZED("Specialized"); + + /** The actual serialized value for a OperatingSystemStateTypes instance. */ + private final String value; + + OperatingSystemStateTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperatingSystemStateTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed OperatingSystemStateTypes object, or null if unable to parse. + */ + @JsonCreator + public static OperatingSystemStateTypes fromString(String value) { + OperatingSystemStateTypes[] items = OperatingSystemStateTypes.values(); + for (OperatingSystemStateTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemType.java new file mode 100644 index 0000000000000..86531fe7984b0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatingSystemType. */ +public final class OperatingSystemType extends ExpandableStringEnum { + /** Static value Windows for OperatingSystemType. */ + public static final OperatingSystemType WINDOWS = fromString("Windows"); + + /** Static value Linux for OperatingSystemType. */ + public static final OperatingSystemType LINUX = fromString("Linux"); + + /** + * Creates or finds a OperatingSystemType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatingSystemType. + */ + @JsonCreator + public static OperatingSystemType fromString(String name) { + return fromString(name, OperatingSystemType.class); + } + + /** @return known OperatingSystemType values. */ + public static Collection values() { + return values(OperatingSystemType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemTypes.java new file mode 100644 index 0000000000000..9a552279c0b59 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OperatingSystemTypes.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for OperatingSystemTypes. */ +public enum OperatingSystemTypes { + /** Enum value Windows. */ + WINDOWS("Windows"), + + /** Enum value Linux. */ + LINUX("Linux"); + + /** The actual serialized value for a OperatingSystemTypes instance. */ + private final String value; + + OperatingSystemTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperatingSystemTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed OperatingSystemTypes object, or null if unable to parse. + */ + @JsonCreator + public static OperatingSystemTypes fromString(String value) { + OperatingSystemTypes[] items = OperatingSystemTypes.values(); + for (OperatingSystemTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Operations.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Operations.java new file mode 100644 index 0000000000000..49a52423ba1a3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Gets a list of compute operations. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + PagedIterable list(); + + /** + * Gets a list of compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of compute operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationMode.java new file mode 100644 index 0000000000000..8f259b8d08aa8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OrchestrationMode. */ +public final class OrchestrationMode extends ExpandableStringEnum { + /** Static value Uniform for OrchestrationMode. */ + public static final OrchestrationMode UNIFORM = fromString("Uniform"); + + /** Static value Flexible for OrchestrationMode. */ + public static final OrchestrationMode FLEXIBLE = fromString("Flexible"); + + /** + * Creates or finds a OrchestrationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrchestrationMode. + */ + @JsonCreator + public static OrchestrationMode fromString(String name) { + return fromString(name, OrchestrationMode.class); + } + + /** @return known OrchestrationMode values. */ + public static Collection values() { + return values(OrchestrationMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceNames.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceNames.java new file mode 100644 index 0000000000000..ad541120c58b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceNames.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OrchestrationServiceNames. */ +public final class OrchestrationServiceNames extends ExpandableStringEnum { + /** Static value AutomaticRepairs for OrchestrationServiceNames. */ + public static final OrchestrationServiceNames AUTOMATIC_REPAIRS = fromString("AutomaticRepairs"); + + /** + * Creates or finds a OrchestrationServiceNames from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrchestrationServiceNames. + */ + @JsonCreator + public static OrchestrationServiceNames fromString(String name) { + return fromString(name, OrchestrationServiceNames.class); + } + + /** @return known OrchestrationServiceNames values. */ + public static Collection values() { + return values(OrchestrationServiceNames.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceState.java new file mode 100644 index 0000000000000..dd842f23ea94a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OrchestrationServiceState. */ +public final class OrchestrationServiceState extends ExpandableStringEnum { + /** Static value NotRunning for OrchestrationServiceState. */ + public static final OrchestrationServiceState NOT_RUNNING = fromString("NotRunning"); + + /** Static value Running for OrchestrationServiceState. */ + public static final OrchestrationServiceState RUNNING = fromString("Running"); + + /** Static value Suspended for OrchestrationServiceState. */ + public static final OrchestrationServiceState SUSPENDED = fromString("Suspended"); + + /** + * Creates or finds a OrchestrationServiceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrchestrationServiceState. + */ + @JsonCreator + public static OrchestrationServiceState fromString(String name) { + return fromString(name, OrchestrationServiceState.class); + } + + /** @return known OrchestrationServiceState values. */ + public static Collection values() { + return values(OrchestrationServiceState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateAction.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateAction.java new file mode 100644 index 0000000000000..eed7dd00a20e9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateAction.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OrchestrationServiceStateAction. */ +public final class OrchestrationServiceStateAction extends ExpandableStringEnum { + /** Static value Resume for OrchestrationServiceStateAction. */ + public static final OrchestrationServiceStateAction RESUME = fromString("Resume"); + + /** Static value Suspend for OrchestrationServiceStateAction. */ + public static final OrchestrationServiceStateAction SUSPEND = fromString("Suspend"); + + /** + * Creates or finds a OrchestrationServiceStateAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrchestrationServiceStateAction. + */ + @JsonCreator + public static OrchestrationServiceStateAction fromString(String name) { + return fromString(name, OrchestrationServiceStateAction.class); + } + + /** @return known OrchestrationServiceStateAction values. */ + public static Collection values() { + return values(OrchestrationServiceStateAction.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateInput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateInput.java new file mode 100644 index 0000000000000..8023b1498c63b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceStateInput.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The input for OrchestrationServiceState. */ +@Fluent +public final class OrchestrationServiceStateInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OrchestrationServiceStateInput.class); + + /* + * The name of the service. + */ + @JsonProperty(value = "serviceName", required = true) + private OrchestrationServiceNames serviceName; + + /* + * The action to be performed. + */ + @JsonProperty(value = "action", required = true) + private OrchestrationServiceStateAction action; + + /** + * Get the serviceName property: The name of the service. + * + * @return the serviceName value. + */ + public OrchestrationServiceNames serviceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: The name of the service. + * + * @param serviceName the serviceName value to set. + * @return the OrchestrationServiceStateInput object itself. + */ + public OrchestrationServiceStateInput withServiceName(OrchestrationServiceNames serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Get the action property: The action to be performed. + * + * @return the action value. + */ + public OrchestrationServiceStateAction action() { + return this.action; + } + + /** + * Set the action property: The action to be performed. + * + * @param action the action value to set. + * @return the OrchestrationServiceStateInput object itself. + */ + public OrchestrationServiceStateInput withAction(OrchestrationServiceStateAction action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serviceName in model OrchestrationServiceStateInput")); + } + if (action() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property action in model OrchestrationServiceStateInput")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceSummary.java new file mode 100644 index 0000000000000..f024e0ce98a44 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/OrchestrationServiceSummary.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Summary for an orchestration service of a virtual machine scale set. */ +@Immutable +public final class OrchestrationServiceSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OrchestrationServiceSummary.class); + + /* + * The name of the service. + */ + @JsonProperty(value = "serviceName", access = JsonProperty.Access.WRITE_ONLY) + private OrchestrationServiceNames serviceName; + + /* + * The current state of the service. + */ + @JsonProperty(value = "serviceState", access = JsonProperty.Access.WRITE_ONLY) + private OrchestrationServiceState serviceState; + + /** + * Get the serviceName property: The name of the service. + * + * @return the serviceName value. + */ + public OrchestrationServiceNames serviceName() { + return this.serviceName; + } + + /** + * Get the serviceState property: The current state of the service. + * + * @return the serviceState value. + */ + public OrchestrationServiceState serviceState() { + return this.serviceState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PassNames.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PassNames.java new file mode 100644 index 0000000000000..285549c1cd6a0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PassNames.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PassNames. */ +public enum PassNames { + /** Enum value OobeSystem. */ + OOBE_SYSTEM("OobeSystem"); + + /** The actual serialized value for a PassNames instance. */ + private final String value; + + PassNames(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PassNames instance. + * + * @param value the serialized value to parse. + * @return the parsed PassNames object, or null if unable to parse. + */ + @JsonCreator + public static PassNames fromString(String value) { + PassNames[] items = PassNames.values(); + for (PassNames item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchAssessmentState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchAssessmentState.java new file mode 100644 index 0000000000000..6fb4844c63cd3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchAssessmentState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PatchAssessmentState. */ +public final class PatchAssessmentState extends ExpandableStringEnum { + /** Static value Unknown for PatchAssessmentState. */ + public static final PatchAssessmentState UNKNOWN = fromString("Unknown"); + + /** Static value Available for PatchAssessmentState. */ + public static final PatchAssessmentState AVAILABLE = fromString("Available"); + + /** + * Creates or finds a PatchAssessmentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PatchAssessmentState. + */ + @JsonCreator + public static PatchAssessmentState fromString(String name) { + return fromString(name, PatchAssessmentState.class); + } + + /** @return known PatchAssessmentState values. */ + public static Collection values() { + return values(PatchAssessmentState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationDetail.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationDetail.java new file mode 100644 index 0000000000000..3e74e2ab62627 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationDetail.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about a specific patch that was encountered during an installation action. */ +@Immutable +public final class PatchInstallationDetail { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchInstallationDetail.class); + + /* + * A unique identifier for the patch. + */ + @JsonProperty(value = "patchId", access = JsonProperty.Access.WRITE_ONLY) + private String patchId; + + /* + * The friendly name of the patch. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The version string of the package. It may conform to Semantic + * Versioning. Only applies to Linux. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The KBID of the patch. Only applies to Windows patches. + */ + @JsonProperty(value = "kbId", access = JsonProperty.Access.WRITE_ONLY) + private String kbId; + + /* + * The classification(s) of the patch as provided by the patch publisher. + */ + @JsonProperty(value = "classifications", access = JsonProperty.Access.WRITE_ONLY) + private List classifications; + + /* + * The state of the patch after the installation operation completed. + */ + @JsonProperty(value = "installationState", access = JsonProperty.Access.WRITE_ONLY) + private PatchInstallationState installationState; + + /** + * Get the patchId property: A unique identifier for the patch. + * + * @return the patchId value. + */ + public String patchId() { + return this.patchId; + } + + /** + * Get the name property: The friendly name of the patch. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the version property: The version string of the package. It may conform to Semantic Versioning. Only applies + * to Linux. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the kbId property: The KBID of the patch. Only applies to Windows patches. + * + * @return the kbId value. + */ + public String kbId() { + return this.kbId; + } + + /** + * Get the classifications property: The classification(s) of the patch as provided by the patch publisher. + * + * @return the classifications value. + */ + public List classifications() { + return this.classifications; + } + + /** + * Get the installationState property: The state of the patch after the installation operation completed. + * + * @return the installationState value. + */ + public PatchInstallationState installationState() { + return this.installationState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationState.java new file mode 100644 index 0000000000000..e8bf94c2ffe10 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchInstallationState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PatchInstallationState. */ +public final class PatchInstallationState extends ExpandableStringEnum { + /** Static value Unknown for PatchInstallationState. */ + public static final PatchInstallationState UNKNOWN = fromString("Unknown"); + + /** Static value Installed for PatchInstallationState. */ + public static final PatchInstallationState INSTALLED = fromString("Installed"); + + /** Static value Failed for PatchInstallationState. */ + public static final PatchInstallationState FAILED = fromString("Failed"); + + /** Static value Excluded for PatchInstallationState. */ + public static final PatchInstallationState EXCLUDED = fromString("Excluded"); + + /** Static value NotSelected for PatchInstallationState. */ + public static final PatchInstallationState NOT_SELECTED = fromString("NotSelected"); + + /** Static value Pending for PatchInstallationState. */ + public static final PatchInstallationState PENDING = fromString("Pending"); + + /** + * Creates or finds a PatchInstallationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PatchInstallationState. + */ + @JsonCreator + public static PatchInstallationState fromString(String name) { + return fromString(name, PatchInstallationState.class); + } + + /** @return known PatchInstallationState values. */ + public static Collection values() { + return values(PatchInstallationState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchOperationStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchOperationStatus.java new file mode 100644 index 0000000000000..d3304fac645fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchOperationStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PatchOperationStatus. */ +public final class PatchOperationStatus extends ExpandableStringEnum { + /** Static value Unknown for PatchOperationStatus. */ + public static final PatchOperationStatus UNKNOWN = fromString("Unknown"); + + /** Static value InProgress for PatchOperationStatus. */ + public static final PatchOperationStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Failed for PatchOperationStatus. */ + public static final PatchOperationStatus FAILED = fromString("Failed"); + + /** Static value Succeeded for PatchOperationStatus. */ + public static final PatchOperationStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value CompletedWithWarnings for PatchOperationStatus. */ + public static final PatchOperationStatus COMPLETED_WITH_WARNINGS = fromString("CompletedWithWarnings"); + + /** + * Creates or finds a PatchOperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PatchOperationStatus. + */ + @JsonCreator + public static PatchOperationStatus fromString(String name) { + return fromString(name, PatchOperationStatus.class); + } + + /** @return known PatchOperationStatus values. */ + public static Collection values() { + return values(PatchOperationStatus.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchSettings.java new file mode 100644 index 0000000000000..3cb984653808d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PatchSettings.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies settings related to VM Guest Patching on Windows. */ +@Fluent +public final class PatchSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchSettings.class); + + /* + * Specifies the mode of VM Guest Patching to IaaS virtual machine or + * virtual machines associated to virtual machine scale set with + * OrchestrationMode as Flexible.

    Possible values are:

    **Manual** - You control the application of patches to a virtual + * machine. You do this by applying patches manually inside the VM. In this + * mode, automatic updates are disabled; the property + * WindowsConfiguration.enableAutomaticUpdates must be false

    + * **AutomaticByOS** - The virtual machine will automatically be updated by + * the OS. The property WindowsConfiguration.enableAutomaticUpdates must be + * true.

    **AutomaticByPlatform** - the virtual machine will + * automatically updated by the platform. The properties provisionVMAgent + * and WindowsConfiguration.enableAutomaticUpdates must be true + */ + @JsonProperty(value = "patchMode") + private WindowsVMGuestPatchMode patchMode; + + /* + * Enables customers to patch their Azure VMs without requiring a reboot. + * For enableHotpatching, the 'provisionVMAgent' must be set to true and + * 'patchMode' must be set to 'AutomaticByPlatform'. + */ + @JsonProperty(value = "enableHotpatching") + private Boolean enableHotpatching; + + /* + * Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.

    Possible values are:

    **ImageDefault** - + * You control the timing of patch assessments on a virtual machine.

    **AutomaticByPlatform** - The platform will trigger periodic + * patch assessments. The property provisionVMAgent must be true. + */ + @JsonProperty(value = "assessmentMode") + private WindowsPatchAssessmentMode assessmentMode; + + /** + * Get the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines + * associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible + * values are:<br /><br /> **Manual** - You control the application of patches to a virtual machine. You + * do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property + * WindowsConfiguration.enableAutomaticUpdates must be false<br /><br /> **AutomaticByOS** - The virtual + * machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be + * true. <br /><br /> **AutomaticByPlatform** - the virtual machine will automatically updated by the + * platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. + * + * @return the patchMode value. + */ + public WindowsVMGuestPatchMode patchMode() { + return this.patchMode; + } + + /** + * Set the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines + * associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible + * values are:<br /><br /> **Manual** - You control the application of patches to a virtual machine. You + * do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property + * WindowsConfiguration.enableAutomaticUpdates must be false<br /><br /> **AutomaticByOS** - The virtual + * machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be + * true. <br /><br /> **AutomaticByPlatform** - the virtual machine will automatically updated by the + * platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. + * + * @param patchMode the patchMode value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withPatchMode(WindowsVMGuestPatchMode patchMode) { + this.patchMode = patchMode; + return this; + } + + /** + * Get the enableHotpatching property: Enables customers to patch their Azure VMs without requiring a reboot. For + * enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to + * 'AutomaticByPlatform'. + * + * @return the enableHotpatching value. + */ + public Boolean enableHotpatching() { + return this.enableHotpatching; + } + + /** + * Set the enableHotpatching property: Enables customers to patch their Azure VMs without requiring a reboot. For + * enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to + * 'AutomaticByPlatform'. + * + * @param enableHotpatching the enableHotpatching value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withEnableHotpatching(Boolean enableHotpatching) { + this.enableHotpatching = enableHotpatching; + return this; + } + + /** + * Get the assessmentMode property: Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the + * timing of patch assessments on a virtual machine.<br /><br /> **AutomaticByPlatform** - The platform + * will trigger periodic patch assessments. The property provisionVMAgent must be true. + * + * @return the assessmentMode value. + */ + public WindowsPatchAssessmentMode assessmentMode() { + return this.assessmentMode; + } + + /** + * Set the assessmentMode property: Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the + * timing of patch assessments on a virtual machine.<br /><br /> **AutomaticByPlatform** - The platform + * will trigger periodic patch assessments. The property provisionVMAgent must be true. + * + * @param assessmentMode the assessmentMode value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withAssessmentMode(WindowsPatchAssessmentMode assessmentMode) { + this.assessmentMode = assessmentMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirCommunityGalleryResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirCommunityGalleryResource.java new file mode 100644 index 0000000000000..77f85678ced8e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirCommunityGalleryResource.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.CommunityGalleryIdentifier; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Base information about the community gallery resource in pir. */ +@Fluent +public class PirCommunityGalleryResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PirCommunityGalleryResource.class); + + /* + * Resource name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource location + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The identifier information of community gallery. + */ + @JsonProperty(value = "identifier") + private CommunityGalleryIdentifier innerIdentifier; + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerIdentifier property: The identifier information of community gallery. + * + * @return the innerIdentifier value. + */ + private CommunityGalleryIdentifier innerIdentifier() { + return this.innerIdentifier; + } + + /** + * Get the uniqueId property: The unique id of this community gallery. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerIdentifier() == null ? null : this.innerIdentifier().uniqueId(); + } + + /** + * Set the uniqueId property: The unique id of this community gallery. + * + * @param uniqueId the uniqueId value to set. + * @return the PirCommunityGalleryResource object itself. + */ + public PirCommunityGalleryResource withUniqueId(String uniqueId) { + if (this.innerIdentifier() == null) { + this.innerIdentifier = new CommunityGalleryIdentifier(); + } + this.innerIdentifier().withUniqueId(uniqueId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerIdentifier() != null) { + innerIdentifier().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirResource.java new file mode 100644 index 0000000000000..80da06f4a9e27 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirResource.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Resource model definition. */ +@Immutable +public class PirResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PirResource.class); + + /* + * Resource name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource location + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirSharedGalleryResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirSharedGalleryResource.java new file mode 100644 index 0000000000000..1b36eff4c76d0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PirSharedGalleryResource.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryIdentifier; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Base information about the shared gallery resource in pir. */ +@Fluent +public class PirSharedGalleryResource extends PirResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PirSharedGalleryResource.class); + + /* + * The identifier information of shared gallery. + */ + @JsonProperty(value = "identifier") + private SharedGalleryIdentifier innerIdentifier; + + /** + * Get the innerIdentifier property: The identifier information of shared gallery. + * + * @return the innerIdentifier value. + */ + private SharedGalleryIdentifier innerIdentifier() { + return this.innerIdentifier; + } + + /** + * Get the uniqueId property: The unique id of this shared gallery. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerIdentifier() == null ? null : this.innerIdentifier().uniqueId(); + } + + /** + * Set the uniqueId property: The unique id of this shared gallery. + * + * @param uniqueId the uniqueId value to set. + * @return the PirSharedGalleryResource object itself. + */ + public PirSharedGalleryResource withUniqueId(String uniqueId) { + if (this.innerIdentifier() == null) { + this.innerIdentifier = new SharedGalleryIdentifier(); + } + this.innerIdentifier().withUniqueId(uniqueId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerIdentifier() != null) { + innerIdentifier().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Plan.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Plan.java new file mode 100644 index 0000000000000..31466108821c1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Plan.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies information about the marketplace image used to create the virtual machine. This element is only used for + * marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic + * use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information and then click **Save**. + */ +@Fluent +public final class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the product of the image from the marketplace. This is the + * same value as Offer under the imageReference element. + */ + @JsonProperty(value = "product") + private String product; + + /* + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /** + * Get the name property: The plan ID. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan ID. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher ID. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: The promotion code. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: The promotion code. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpoint.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..376d9ec4c29f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint resource. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The ARM identifier for Private Endpoint + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The ARM identifier for Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnection.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..1ece20de4095c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * 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 privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: A collection of information about the state of the + * connection between DiskAccess and Virtual Network. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..0249ede75d930 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /* + * The uri to fetch the next page of snapshots. Call ListNext() with this + * to fetch the next page of snapshots. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the + * next page of snapshots. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the + * next page of snapshots. + * + * @param nextLink the nextLink value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionProvisioningState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..f83c6eb0977b9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointConnectionProvisioningState. */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Creating for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** @return known PrivateEndpointConnectionProvisioningState values. */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointServiceConnectionStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..88512753013e3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointServiceConnectionStatus. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** @return known PrivateEndpointServiceConnectionStatus values. */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..32955fa5db341 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResource.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResource.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /* + * private link resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * private link resource name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * private link resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: private link resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: private link resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: private link resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: The private link resource DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResource object itself. + */ + public PrivateLinkResource withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResourceListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..c2fa9505f5566 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResourceListResult. */ +public interface PrivateLinkResourceListResult { + /** + * Gets the value property: Array of private link resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.PrivateLinkResourceListResultInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourceListResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkServiceConnectionState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..5c4d1ebb402ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A collection of information about the state of the connection between service consumer and provider. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * Indicates whether the connection has been Approved/Rejected/Removed by + * the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any + * updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PropertyUpdatesInProgress.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PropertyUpdatesInProgress.java new file mode 100644 index 0000000000000..caaa15620d0dd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PropertyUpdatesInProgress.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the disk for which update is pending. */ +@Fluent +public final class PropertyUpdatesInProgress { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PropertyUpdatesInProgress.class); + + /* + * The target performance tier of the disk if a tier change operation is in + * progress. + */ + @JsonProperty(value = "targetTier") + private String targetTier; + + /** + * Get the targetTier property: The target performance tier of the disk if a tier change operation is in progress. + * + * @return the targetTier value. + */ + public String targetTier() { + return this.targetTier; + } + + /** + * Set the targetTier property: The target performance tier of the disk if a tier change operation is in progress. + * + * @param targetTier the targetTier value to set. + * @return the PropertyUpdatesInProgress object itself. + */ + public PropertyUpdatesInProgress withTargetTier(String targetTier) { + this.targetTier = targetTier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProtocolTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProtocolTypes.java new file mode 100644 index 0000000000000..dcae935dab597 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProtocolTypes.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ProtocolTypes. */ +public enum ProtocolTypes { + /** Enum value Http. */ + HTTP("Http"), + + /** Enum value Https. */ + HTTPS("Https"); + + /** The actual serialized value for a ProtocolTypes instance. */ + private final String value; + + ProtocolTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProtocolTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed ProtocolTypes object, or null if unable to parse. + */ + @JsonCreator + public static ProtocolTypes fromString(String value) { + ProtocolTypes[] items = ProtocolTypes.values(); + for (ProtocolTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroup.java new file mode 100644 index 0000000000000..d616a12670bc4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroup.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ProximityPlacementGroup. */ +public interface ProximityPlacementGroup { + /** + * 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 proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within an Azure + * region or Availability Zone. <br><br> **Ultra** : For future use. + * + * @return the proximityPlacementGroupType value. + */ + ProximityPlacementGroupType proximityPlacementGroupType(); + + /** + * Gets the virtualMachines property: A list of references to all virtual machines in the proximity placement group. + * + * @return the virtualMachines value. + */ + List virtualMachines(); + + /** + * Gets the virtualMachineScaleSets property: A list of references to all virtual machine scale sets in the + * proximity placement group. + * + * @return the virtualMachineScaleSets value. + */ + List virtualMachineScaleSets(); + + /** + * Gets the availabilitySets property: A list of references to all availability sets in the proximity placement + * group. + * + * @return the availabilitySets value. + */ + List availabilitySets(); + + /** + * Gets the colocationStatus property: Describes colocation status of the Proximity Placement Group. + * + * @return the colocationStatus value. + */ + InstanceViewStatus colocationStatus(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner object. + * + * @return the inner object. + */ + ProximityPlacementGroupInner innerModel(); + + /** The entirety of the ProximityPlacementGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ProximityPlacementGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ProximityPlacementGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ProximityPlacementGroup 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 ProximityPlacementGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ProximityPlacementGroup 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.WithProximityPlacementGroupType, + DefinitionStages.WithColocationStatus { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProximityPlacementGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProximityPlacementGroup create(Context context); + } + /** The stage of the ProximityPlacementGroup 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 ProximityPlacementGroup definition allowing to specify proximityPlacementGroupType. */ + interface WithProximityPlacementGroupType { + /** + * Specifies the proximityPlacementGroupType property: Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources within + * an Azure region or Availability Zone. <br><br> **Ultra** : For future use.. + * + * @param proximityPlacementGroupType Specifies the type of the proximity placement group. + * <br><br> Possible values are: <br><br> **Standard** : Co-locate resources + * within an Azure region or Availability Zone. <br><br> **Ultra** : For future use. + * @return the next definition stage. + */ + WithCreate withProximityPlacementGroupType(ProximityPlacementGroupType proximityPlacementGroupType); + } + /** The stage of the ProximityPlacementGroup definition allowing to specify colocationStatus. */ + interface WithColocationStatus { + /** + * Specifies the colocationStatus property: Describes colocation status of the Proximity Placement Group.. + * + * @param colocationStatus Describes colocation status of the Proximity Placement Group. + * @return the next definition stage. + */ + WithCreate withColocationStatus(InstanceViewStatus colocationStatus); + } + } + /** + * Begins update for the ProximityPlacementGroup resource. + * + * @return the stage of resource update. + */ + ProximityPlacementGroup.Update update(); + + /** The template for ProximityPlacementGroup update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ProximityPlacementGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ProximityPlacementGroup apply(Context context); + } + /** The ProximityPlacementGroup update stages. */ + interface UpdateStages { + /** The stage of the ProximityPlacementGroup 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. + */ + ProximityPlacementGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProximityPlacementGroup refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupListResult.java new file mode 100644 index 0000000000000..14551a4e76465 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupListResult.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.ProximityPlacementGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Proximity Placement Group operation response. */ +@Fluent +public final class ProximityPlacementGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupListResult.class); + + /* + * The list of proximity placement groups + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of proximity placement groups. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of proximity placement groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of proximity placement groups. + * + * @param value the value value to set. + * @return the ProximityPlacementGroupListResult object itself. + */ + public ProximityPlacementGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of proximity placement groups. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of proximity placement groups. + * + * @param nextLink the nextLink value to set. + * @return the ProximityPlacementGroupListResult object itself. + */ + public ProximityPlacementGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ProximityPlacementGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupType.java new file mode 100644 index 0000000000000..3c9e6d00a42f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProximityPlacementGroupType. */ +public final class ProximityPlacementGroupType extends ExpandableStringEnum { + /** Static value Standard for ProximityPlacementGroupType. */ + public static final ProximityPlacementGroupType STANDARD = fromString("Standard"); + + /** Static value Ultra for ProximityPlacementGroupType. */ + public static final ProximityPlacementGroupType ULTRA = fromString("Ultra"); + + /** + * Creates or finds a ProximityPlacementGroupType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProximityPlacementGroupType. + */ + @JsonCreator + public static ProximityPlacementGroupType fromString(String name) { + return fromString(name, ProximityPlacementGroupType.class); + } + + /** @return known ProximityPlacementGroupType values. */ + public static Collection values() { + return values(ProximityPlacementGroupType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupUpdate.java new file mode 100644 index 0000000000000..9b0bd5ab65c16 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroupUpdate.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** Specifies information about the proximity placement group. */ +@Fluent +public final class ProximityPlacementGroupUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProximityPlacementGroupUpdate.class); + + /** {@inheritDoc} */ + @Override + public ProximityPlacementGroupUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroups.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroups.java new file mode 100644 index 0000000000000..121a84b3f2273 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProximityPlacementGroups.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 ProximityPlacementGroups. */ +public interface ProximityPlacementGroups { + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 proximityPlacementGroupName); + + /** + * Delete a proximity placement group. + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteWithResponse(String resourceGroupName, String proximityPlacementGroupName, Context context); + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group. + */ + ProximityPlacementGroup getByResourceGroup(String resourceGroupName, String proximityPlacementGroupName); + + /** + * Retrieves information about a proximity placement group . + * + * @param resourceGroupName The name of the resource group. + * @param proximityPlacementGroupName The name of the proximity placement group. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String proximityPlacementGroupName, String includeColocationStatus, Context context); + + /** + * Lists all proximity placement groups in a subscription. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + PagedIterable list(); + + /** + * Lists all proximity placement groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + PagedIterable list(Context context); + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all proximity placement groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Proximity Placement Group operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves information about a proximity placement group . + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + ProximityPlacementGroup getById(String id); + + /** + * Retrieves information about a proximity placement group . + * + * @param id the resource ID. + * @param includeColocationStatus includeColocationStatus=true enables fetching the colocation status of all the + * resources in the proximity placement group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the proximity placement group along with {@link Response}. + */ + Response getByIdWithResponse(String id, String includeColocationStatus, Context context); + + /** + * Delete a proximity placement group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a proximity placement 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.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProximityPlacementGroup resource. + * + * @param name resource name. + * @return the first stage of the new ProximityPlacementGroup definition. + */ + ProximityPlacementGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProxyOnlyResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProxyOnlyResource.java new file mode 100644 index 0000000000000..01714952217f4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ProxyOnlyResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ProxyOnly Resource model definition. */ +@Immutable +public class ProxyOnlyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProxyOnlyResource.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSku.java new file mode 100644 index 0000000000000..e2c8cd5990602 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSku.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. */ +@Fluent +public final class PublicIpAddressSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PublicIpAddressSku.class); + + /* + * Specify public IP sku name + */ + @JsonProperty(value = "name") + private PublicIpAddressSkuName name; + + /* + * Specify public IP sku tier + */ + @JsonProperty(value = "tier") + private PublicIpAddressSkuTier tier; + + /** + * Get the name property: Specify public IP sku name. + * + * @return the name value. + */ + public PublicIpAddressSkuName name() { + return this.name; + } + + /** + * Set the name property: Specify public IP sku name. + * + * @param name the name value to set. + * @return the PublicIpAddressSku object itself. + */ + public PublicIpAddressSku withName(PublicIpAddressSkuName name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Specify public IP sku tier. + * + * @return the tier value. + */ + public PublicIpAddressSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: Specify public IP sku tier. + * + * @param tier the tier value to set. + * @return the PublicIpAddressSku object itself. + */ + public PublicIpAddressSku withTier(PublicIpAddressSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuName.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuName.java new file mode 100644 index 0000000000000..c941d53a901c8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuName.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicIpAddressSkuName. */ +public final class PublicIpAddressSkuName extends ExpandableStringEnum { + /** Static value Basic for PublicIpAddressSkuName. */ + public static final PublicIpAddressSkuName BASIC = fromString("Basic"); + + /** Static value Standard for PublicIpAddressSkuName. */ + public static final PublicIpAddressSkuName STANDARD = fromString("Standard"); + + /** + * Creates or finds a PublicIpAddressSkuName from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicIpAddressSkuName. + */ + @JsonCreator + public static PublicIpAddressSkuName fromString(String name) { + return fromString(name, PublicIpAddressSkuName.class); + } + + /** @return known PublicIpAddressSkuName values. */ + public static Collection values() { + return values(PublicIpAddressSkuName.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuTier.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuTier.java new file mode 100644 index 0000000000000..9b2534377c621 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAddressSkuTier.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicIpAddressSkuTier. */ +public final class PublicIpAddressSkuTier extends ExpandableStringEnum { + /** Static value Regional for PublicIpAddressSkuTier. */ + public static final PublicIpAddressSkuTier REGIONAL = fromString("Regional"); + + /** Static value Global for PublicIpAddressSkuTier. */ + public static final PublicIpAddressSkuTier GLOBAL = fromString("Global"); + + /** + * Creates or finds a PublicIpAddressSkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicIpAddressSkuTier. + */ + @JsonCreator + public static PublicIpAddressSkuTier fromString(String name) { + return fromString(name, PublicIpAddressSkuTier.class); + } + + /** @return known PublicIpAddressSkuTier values. */ + public static Collection values() { + return values(PublicIpAddressSkuTier.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAllocationMethod.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAllocationMethod.java new file mode 100644 index 0000000000000..5ef83fb399eb7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicIpAllocationMethod.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicIpAllocationMethod. */ +public final class PublicIpAllocationMethod extends ExpandableStringEnum { + /** Static value Dynamic for PublicIpAllocationMethod. */ + public static final PublicIpAllocationMethod DYNAMIC = fromString("Dynamic"); + + /** Static value Static for PublicIpAllocationMethod. */ + public static final PublicIpAllocationMethod STATIC = fromString("Static"); + + /** + * Creates or finds a PublicIpAllocationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicIpAllocationMethod. + */ + @JsonCreator + public static PublicIpAllocationMethod fromString(String name) { + return fromString(name, PublicIpAllocationMethod.class); + } + + /** @return known PublicIpAllocationMethod values. */ + public static Collection values() { + return values(PublicIpAllocationMethod.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicNetworkAccess.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..59bf550b31344 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PublicNetworkAccess.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlan.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlan.java new file mode 100644 index 0000000000000..3f1d25b79a381 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlan.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. */ +@Fluent +public final class PurchasePlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PurchasePlan.class); + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The plan ID. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Specifies the product of the image from the marketplace. This is the + * same value as Offer under the imageReference element. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /** + * Get the publisher property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher ID. + * + * @param publisher the publisher value to set. + * @return the PurchasePlan object itself. + */ + public PurchasePlan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the name property: The plan ID. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan ID. + * + * @param name the name value to set. + * @return the PurchasePlan object itself. + */ + public PurchasePlan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @param product the product value to set. + * @return the PurchasePlan object itself. + */ + public PurchasePlan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property publisher in model PurchasePlan")); + } + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model PurchasePlan")); + } + if (product() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property product in model PurchasePlan")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlanAutoGenerated.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlanAutoGenerated.java new file mode 100644 index 0000000000000..8475024ba5562 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/PurchasePlanAutoGenerated.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. */ +@Fluent +public final class PurchasePlanAutoGenerated { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PurchasePlanAutoGenerated.class); + + /* + * The plan ID. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * Specifies the product of the image from the marketplace. This is the + * same value as Offer under the imageReference element. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * The Offer Promotion Code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /** + * Get the name property: The plan ID. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The plan ID. + * + * @param name the name value to set. + * @return the PurchasePlanAutoGenerated object itself. + */ + public PurchasePlanAutoGenerated withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher ID. + * + * @param publisher the publisher value to set. + * @return the PurchasePlanAutoGenerated object itself. + */ + public PurchasePlanAutoGenerated withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: Specifies the product of the image from the marketplace. This is the same value as + * Offer under the imageReference element. + * + * @param product the product value to set. + * @return the PurchasePlanAutoGenerated object itself. + */ + public PurchasePlanAutoGenerated withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: The Offer Promotion Code. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: The Offer Promotion Code. + * + * @param promotionCode the promotionCode value to set. + * @return the PurchasePlanAutoGenerated object itself. + */ + public PurchasePlanAutoGenerated withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model PurchasePlanAutoGenerated")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisher in model PurchasePlanAutoGenerated")); + } + if (product() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property product in model PurchasePlanAutoGenerated")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecommendedMachineConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecommendedMachineConfiguration.java new file mode 100644 index 0000000000000..a722a0a60f43a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecommendedMachineConfiguration.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties describe the recommended machine configuration for this Image Definition. These properties are + * updatable. + */ +@Fluent +public final class RecommendedMachineConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedMachineConfiguration.class); + + /* + * Describes the resource range. + */ + @JsonProperty(value = "vCPUs") + private ResourceRange vCPUs; + + /* + * Describes the resource range. + */ + @JsonProperty(value = "memory") + private ResourceRange memory; + + /** + * Get the vCPUs property: Describes the resource range. + * + * @return the vCPUs value. + */ + public ResourceRange vCPUs() { + return this.vCPUs; + } + + /** + * Set the vCPUs property: Describes the resource range. + * + * @param vCPUs the vCPUs value to set. + * @return the RecommendedMachineConfiguration object itself. + */ + public RecommendedMachineConfiguration withVCPUs(ResourceRange vCPUs) { + this.vCPUs = vCPUs; + return this; + } + + /** + * Get the memory property: Describes the resource range. + * + * @return the memory value. + */ + public ResourceRange memory() { + return this.memory; + } + + /** + * Set the memory property: Describes the resource range. + * + * @param memory the memory value to set. + * @return the RecommendedMachineConfiguration object itself. + */ + public RecommendedMachineConfiguration withMemory(ResourceRange memory) { + this.memory = memory; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vCPUs() != null) { + vCPUs().validate(); + } + if (memory() != null) { + memory().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecoveryWalkResponse.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecoveryWalkResponse.java new file mode 100644 index 0000000000000..b149333016c82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RecoveryWalkResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RecoveryWalkResponseInner; + +/** An immutable client-side representation of RecoveryWalkResponse. */ +public interface RecoveryWalkResponse { + /** + * Gets the walkPerformed property: Whether the recovery walk was performed. + * + * @return the walkPerformed value. + */ + Boolean walkPerformed(); + + /** + * Gets the nextPlatformUpdateDomain property: The next update domain that needs to be walked. Null means walk + * spanning all update domains has been completed. + * + * @return the nextPlatformUpdateDomain value. + */ + Integer nextPlatformUpdateDomain(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RecoveryWalkResponseInner object. + * + * @return the inner object. + */ + RecoveryWalkResponseInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RegionalReplicationStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RegionalReplicationStatus.java new file mode 100644 index 0000000000000..ef6374f85e816 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RegionalReplicationStatus.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This is the regional replication status. */ +@Immutable +public final class RegionalReplicationStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegionalReplicationStatus.class); + + /* + * The region to which the gallery image version is being replicated to. + */ + @JsonProperty(value = "region", access = JsonProperty.Access.WRITE_ONLY) + private String region; + + /* + * This is the regional replication state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState state; + + /* + * The details of the replication status. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /* + * It indicates progress of the replication job. + */ + @JsonProperty(value = "progress", access = JsonProperty.Access.WRITE_ONLY) + private Integer progress; + + /** + * Get the region property: The region to which the gallery image version is being replicated to. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Get the state property: This is the regional replication state. + * + * @return the state value. + */ + public ReplicationState state() { + return this.state; + } + + /** + * Get the details property: The details of the replication status. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Get the progress property: It indicates progress of the replication job. + * + * @return the progress value. + */ + public Integer progress() { + return this.progress; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RepairAction.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RepairAction.java new file mode 100644 index 0000000000000..8b0abdd4ebc27 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RepairAction.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RepairAction. */ +public final class RepairAction extends ExpandableStringEnum { + /** Static value Replace for RepairAction. */ + public static final RepairAction REPLACE = fromString("Replace"); + + /** Static value Restart for RepairAction. */ + public static final RepairAction RESTART = fromString("Restart"); + + /** Static value Reimage for RepairAction. */ + public static final RepairAction REIMAGE = fromString("Reimage"); + + /** + * Creates or finds a RepairAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding RepairAction. + */ + @JsonCreator + public static RepairAction fromString(String name) { + return fromString(name, RepairAction.class); + } + + /** @return known RepairAction values. */ + public static Collection values() { + return values(RepairAction.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationMode.java new file mode 100644 index 0000000000000..8de0363d21250 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicationMode. */ +public final class ReplicationMode extends ExpandableStringEnum { + /** Static value Full for ReplicationMode. */ + public static final ReplicationMode FULL = fromString("Full"); + + /** Static value Shallow for ReplicationMode. */ + public static final ReplicationMode SHALLOW = fromString("Shallow"); + + /** + * Creates or finds a ReplicationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationMode. + */ + @JsonCreator + public static ReplicationMode fromString(String name) { + return fromString(name, ReplicationMode.class); + } + + /** @return known ReplicationMode values. */ + public static Collection values() { + return values(ReplicationMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationState.java new file mode 100644 index 0000000000000..5d99be44a0652 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationState.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicationState. */ +public final class ReplicationState extends ExpandableStringEnum { + /** Static value Unknown for ReplicationState. */ + public static final ReplicationState UNKNOWN = fromString("Unknown"); + + /** Static value Replicating for ReplicationState. */ + public static final ReplicationState REPLICATING = fromString("Replicating"); + + /** Static value Completed for ReplicationState. */ + public static final ReplicationState COMPLETED = fromString("Completed"); + + /** Static value Failed for ReplicationState. */ + public static final ReplicationState FAILED = fromString("Failed"); + + /** + * Creates or finds a ReplicationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationState. + */ + @JsonCreator + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** @return known ReplicationState values. */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatus.java new file mode 100644 index 0000000000000..b35e2a0bfd69c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatus.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This is the replication status of the gallery image version. */ +@Immutable +public final class ReplicationStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicationStatus.class); + + /* + * This is the aggregated replication status based on all the regional + * replication status flags. + */ + @JsonProperty(value = "aggregatedState", access = JsonProperty.Access.WRITE_ONLY) + private AggregatedReplicationState aggregatedState; + + /* + * This is a summary of replication status for each region. + */ + @JsonProperty(value = "summary", access = JsonProperty.Access.WRITE_ONLY) + private List summary; + + /** + * Get the aggregatedState property: This is the aggregated replication status based on all the regional replication + * status flags. + * + * @return the aggregatedState value. + */ + public AggregatedReplicationState aggregatedState() { + return this.aggregatedState; + } + + /** + * Get the summary property: This is a summary of replication status for each region. + * + * @return the summary value. + */ + public List summary() { + return this.summary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (summary() != null) { + summary().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatusTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatusTypes.java new file mode 100644 index 0000000000000..2a8475c6a049b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ReplicationStatusTypes.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicationStatusTypes. */ +public final class ReplicationStatusTypes extends ExpandableStringEnum { + /** Static value ReplicationStatus for ReplicationStatusTypes. */ + public static final ReplicationStatusTypes REPLICATION_STATUS = fromString("ReplicationStatus"); + + /** + * Creates or finds a ReplicationStatusTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationStatusTypes. + */ + @JsonCreator + public static ReplicationStatusTypes fromString(String name) { + return fromString(name, ReplicationStatusTypes.class); + } + + /** @return known ReplicationStatusTypes values. */ + public static Collection values() { + return values(ReplicationStatusTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RequestRateByIntervalInput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RequestRateByIntervalInput.java new file mode 100644 index 0000000000000..20afc3af1ec8f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RequestRateByIntervalInput.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Api request input for LogAnalytics getRequestRateByInterval Api. */ +@Fluent +public final class RequestRateByIntervalInput extends LogAnalyticsInputBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RequestRateByIntervalInput.class); + + /* + * Interval value in minutes used to create LogAnalytics call rate logs. + */ + @JsonProperty(value = "intervalLength", required = true) + private IntervalInMins intervalLength; + + /** + * Get the intervalLength property: Interval value in minutes used to create LogAnalytics call rate logs. + * + * @return the intervalLength value. + */ + public IntervalInMins intervalLength() { + return this.intervalLength; + } + + /** + * Set the intervalLength property: Interval value in minutes used to create LogAnalytics call rate logs. + * + * @param intervalLength the intervalLength value to set. + * @return the RequestRateByIntervalInput object itself. + */ + public RequestRateByIntervalInput withIntervalLength(IntervalInMins intervalLength) { + this.intervalLength = intervalLength; + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withBlobContainerSasUri(String blobContainerSasUri) { + super.withBlobContainerSasUri(blobContainerSasUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withFromTime(OffsetDateTime fromTime) { + super.withFromTime(fromTime); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withToTime(OffsetDateTime toTime) { + super.withToTime(toTime); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withGroupByThrottlePolicy(Boolean groupByThrottlePolicy) { + super.withGroupByThrottlePolicy(groupByThrottlePolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withGroupByOperationName(Boolean groupByOperationName) { + super.withGroupByOperationName(groupByOperationName); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withGroupByResourceName(Boolean groupByResourceName) { + super.withGroupByResourceName(groupByResourceName); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withGroupByClientApplicationId(Boolean groupByClientApplicationId) { + super.withGroupByClientApplicationId(groupByClientApplicationId); + return this; + } + + /** {@inheritDoc} */ + @Override + public RequestRateByIntervalInput withGroupByUserAgent(Boolean groupByUserAgent) { + super.withGroupByUserAgent(groupByUserAgent); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (intervalLength() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property intervalLength in model RequestRateByIntervalInput")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceIdentityType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..2a1c65564a404 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceIdentityType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceInstanceViewStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceInstanceViewStatus.java new file mode 100644 index 0000000000000..cb96f68844100 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceInstanceViewStatus.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Instance view status. */ +@Fluent +public final class ResourceInstanceViewStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceInstanceViewStatus.class); + + /* + * The status code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The short localizable label for the status. + */ + @JsonProperty(value = "displayStatus", access = JsonProperty.Access.WRITE_ONLY) + private String displayStatus; + + /* + * The detailed status message, including for alerts and error messages. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The time of the status. + */ + @JsonProperty(value = "time", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime time; + + /* + * The level code. + */ + @JsonProperty(value = "level") + private StatusLevelTypes level; + + /** + * Get the code property: The status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * 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; + } + + /** + * Get the level property: The level code. + * + * @return the level value. + */ + public StatusLevelTypes level() { + return this.level; + } + + /** + * Set the level property: The level code. + * + * @param level the level value to set. + * @return the ResourceInstanceViewStatus object itself. + */ + public ResourceInstanceViewStatus withLevel(StatusLevelTypes level) { + this.level = level; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceRange.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceRange.java new file mode 100644 index 0000000000000..49518fdd3108d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceRange.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the resource range. */ +@Fluent +public final class ResourceRange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceRange.class); + + /* + * The minimum number of the resource. + */ + @JsonProperty(value = "min") + private Integer min; + + /* + * The maximum number of the resource. + */ + @JsonProperty(value = "max") + private Integer max; + + /** + * Get the min property: The minimum number of the resource. + * + * @return the min value. + */ + public Integer min() { + return this.min; + } + + /** + * Set the min property: The minimum number of the resource. + * + * @param min the min value to set. + * @return the ResourceRange object itself. + */ + public ResourceRange withMin(Integer min) { + this.min = min; + return this; + } + + /** + * Get the max property: The maximum number of the resource. + * + * @return the max value. + */ + public Integer max() { + return this.max; + } + + /** + * Set the max property: The maximum number of the resource. + * + * @param max the max value to set. + * @return the ResourceRange object itself. + */ + public ResourceRange withMax(Integer max) { + this.max = max; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSku.java new file mode 100644 index 0000000000000..787f51a467941 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSku.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; +import java.util.List; + +/** An immutable client-side representation of ResourceSku. */ +public interface ResourceSku { + /** + * Gets the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the name property: The name of SKU. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible + * Values:<br /><br /> **Standard**<br /><br /> **Basic**. + * + * @return the tier value. + */ + String tier(); + + /** + * Gets the size property: The Size of the SKU. + * + * @return the size value. + */ + String size(); + + /** + * Gets the family property: The Family of this particular SKU. + * + * @return the family value. + */ + String family(); + + /** + * Gets the kind property: The Kind of resources that are supported in this SKU. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the capacity property: Specifies the number of virtual machines in the scale set. + * + * @return the capacity value. + */ + ResourceSkuCapacity capacity(); + + /** + * Gets the locations property: The set of locations that the SKU is available. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the locationInfo property: A list of locations and availability zones in those locations where the SKU is + * available. + * + * @return the locationInfo value. + */ + List locationInfo(); + + /** + * Gets the apiVersions property: The api versions that support this SKU. + * + * @return the apiVersions value. + */ + List apiVersions(); + + /** + * Gets the costs property: Metadata for retrieving price info. + * + * @return the costs value. + */ + List costs(); + + /** + * Gets the capabilities property: A name value pair to describe the capability. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the restrictions property: The restrictions because of which SKU cannot be used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + List restrictions(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner object. + * + * @return the inner object. + */ + ResourceSkuInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapabilities.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapabilities.java new file mode 100644 index 0000000000000..ec66b4acb4853 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapabilities.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes The SKU capabilities object. */ +@Immutable +public final class ResourceSkuCapabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCapabilities.class); + + /* + * An invariant to describe the feature. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * An invariant if the feature is measured by quantity. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the name property: An invariant to describe the feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: An invariant if the feature is measured by quantity. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacity.java new file mode 100644 index 0000000000000..0c506e35a04c6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacity.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes scaling information of a SKU. */ +@Immutable +public final class ResourceSkuCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCapacity.class); + + /* + * The minimum capacity. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Long minimum; + + /* + * The maximum capacity that can be set. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Long maximum; + + /* + * The default capacity. + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultProperty; + + /* + * The scale type applicable to the sku. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuCapacityScaleType scaleType; + + /** + * Get the minimum property: The minimum capacity. + * + * @return the minimum value. + */ + public Long minimum() { + return this.minimum; + } + + /** + * Get the maximum property: The maximum capacity that can be set. + * + * @return the maximum value. + */ + public Long maximum() { + return this.maximum; + } + + /** + * Get the defaultProperty property: The default capacity. + * + * @return the defaultProperty value. + */ + public Long defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the scaleType property: The scale type applicable to the sku. + * + * @return the scaleType value. + */ + public ResourceSkuCapacityScaleType scaleType() { + return this.scaleType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacityScaleType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacityScaleType.java new file mode 100644 index 0000000000000..edccdc5770d35 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCapacityScaleType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceSkuCapacityScaleType. */ +public enum ResourceSkuCapacityScaleType { + /** Enum value Automatic. */ + AUTOMATIC("Automatic"), + + /** Enum value Manual. */ + MANUAL("Manual"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceSkuCapacityScaleType instance. */ + private final String value; + + ResourceSkuCapacityScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceSkuCapacityScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceSkuCapacityScaleType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceSkuCapacityScaleType fromString(String value) { + ResourceSkuCapacityScaleType[] items = ResourceSkuCapacityScaleType.values(); + for (ResourceSkuCapacityScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCosts.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCosts.java new file mode 100644 index 0000000000000..f402221d790ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuCosts.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes metadata for retrieving price info. */ +@Immutable +public final class ResourceSkuCosts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCosts.class); + + /* + * Used for querying price from commerce. + */ + @JsonProperty(value = "meterID", access = JsonProperty.Access.WRITE_ONLY) + private String meterId; + + /* + * The multiplier is needed to extend the base metered cost. + */ + @JsonProperty(value = "quantity", access = JsonProperty.Access.WRITE_ONLY) + private Long quantity; + + /* + * An invariant to show the extended unit. + */ + @JsonProperty(value = "extendedUnit", access = JsonProperty.Access.WRITE_ONLY) + private String extendedUnit; + + /** + * Get the meterId property: Used for querying price from commerce. + * + * @return the meterId value. + */ + public String meterId() { + return this.meterId; + } + + /** + * Get the quantity property: The multiplier is needed to extend the base metered cost. + * + * @return the quantity value. + */ + public Long quantity() { + return this.quantity; + } + + /** + * Get the extendedUnit property: An invariant to show the extended unit. + * + * @return the extendedUnit value. + */ + public String extendedUnit() { + return this.extendedUnit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuLocationInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuLocationInfo.java new file mode 100644 index 0000000000000..a070f7dfe5b54 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuLocationInfo.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes an available Compute SKU Location Information. */ +@Immutable +public final class ResourceSkuLocationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuLocationInfo.class); + + /* + * Location of the SKU + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * List of availability zones where the SKU is supported. + */ + @JsonProperty(value = "zones", access = JsonProperty.Access.WRITE_ONLY) + private List zones; + + /* + * Details of capabilities available to a SKU in specific zones. + */ + @JsonProperty(value = "zoneDetails", access = JsonProperty.Access.WRITE_ONLY) + private List zoneDetails; + + /* + * The names of extended locations. + */ + @JsonProperty(value = "extendedLocations", access = JsonProperty.Access.WRITE_ONLY) + private List extendedLocations; + + /* + * The type of the extended location. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private ExtendedLocationType type; + + /** + * Get the location property: Location of the SKU. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the zones property: List of availability zones where the SKU is supported. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Get the zoneDetails property: Details of capabilities available to a SKU in specific zones. + * + * @return the zoneDetails value. + */ + public List zoneDetails() { + return this.zoneDetails; + } + + /** + * Get the extendedLocations property: The names of extended locations. + * + * @return the extendedLocations value. + */ + public List extendedLocations() { + return this.extendedLocations; + } + + /** + * Get the type property: The type of the extended location. + * + * @return the type value. + */ + public ExtendedLocationType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (zoneDetails() != null) { + zoneDetails().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionInfo.java new file mode 100644 index 0000000000000..4c4939a8e4cc8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionInfo.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes an available Compute SKU Restriction Information. */ +@Immutable +public final class ResourceSkuRestrictionInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictionInfo.class); + + /* + * Locations where the SKU is restricted + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * List of availability zones where the SKU is restricted. + */ + @JsonProperty(value = "zones", access = JsonProperty.Access.WRITE_ONLY) + private List zones; + + /** + * Get the locations property: Locations where the SKU is restricted. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the zones property: List of availability zones where the SKU is restricted. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictions.java new file mode 100644 index 0000000000000..f77516eb364a9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictions.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes scaling information of a SKU. */ +@Immutable +public final class ResourceSkuRestrictions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictions.class); + + /* + * The type of restrictions. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionsType type; + + /* + * The value of restrictions. If the restriction type is set to location. + * This would be different locations where the SKU is restricted. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /* + * The information about the restriction where the SKU cannot be used. + */ + @JsonProperty(value = "restrictionInfo", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionInfo restrictionInfo; + + /* + * The reason for restriction. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionsReasonCode reasonCode; + + /** + * Get the type property: The type of restrictions. + * + * @return the type value. + */ + public ResourceSkuRestrictionsType type() { + return this.type; + } + + /** + * Get the values property: The value of restrictions. If the restriction type is set to location. This would be + * different locations where the SKU is restricted. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Get the restrictionInfo property: The information about the restriction where the SKU cannot be used. + * + * @return the restrictionInfo value. + */ + public ResourceSkuRestrictionInfo restrictionInfo() { + return this.restrictionInfo; + } + + /** + * Get the reasonCode property: The reason for restriction. + * + * @return the reasonCode value. + */ + public ResourceSkuRestrictionsReasonCode reasonCode() { + return this.reasonCode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restrictionInfo() != null) { + restrictionInfo().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsReasonCode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsReasonCode.java new file mode 100644 index 0000000000000..05622944323ae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsReasonCode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceSkuRestrictionsReasonCode. */ +public enum ResourceSkuRestrictionsReasonCode { + /** Enum value QuotaId. */ + QUOTA_ID("QuotaId"), + + /** Enum value NotAvailableForSubscription. */ + NOT_AVAILABLE_FOR_SUBSCRIPTION("NotAvailableForSubscription"); + + /** The actual serialized value for a ResourceSkuRestrictionsReasonCode instance. */ + private final String value; + + ResourceSkuRestrictionsReasonCode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceSkuRestrictionsReasonCode instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceSkuRestrictionsReasonCode object, or null if unable to parse. + */ + @JsonCreator + public static ResourceSkuRestrictionsReasonCode fromString(String value) { + ResourceSkuRestrictionsReasonCode[] items = ResourceSkuRestrictionsReasonCode.values(); + for (ResourceSkuRestrictionsReasonCode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsType.java new file mode 100644 index 0000000000000..47b056fec98a9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuRestrictionsType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceSkuRestrictionsType. */ +public enum ResourceSkuRestrictionsType { + /** Enum value Location. */ + LOCATION("Location"), + + /** Enum value Zone. */ + ZONE("Zone"); + + /** The actual serialized value for a ResourceSkuRestrictionsType instance. */ + private final String value; + + ResourceSkuRestrictionsType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceSkuRestrictionsType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceSkuRestrictionsType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceSkuRestrictionsType fromString(String value) { + ResourceSkuRestrictionsType[] items = ResourceSkuRestrictionsType.values(); + for (ResourceSkuRestrictionsType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuZoneDetails.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuZoneDetails.java new file mode 100644 index 0000000000000..f989c9f1e4a4e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkuZoneDetails.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes The zonal capabilities of a SKU. */ +@Immutable +public final class ResourceSkuZoneDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuZoneDetails.class); + + /* + * The set of zones that the SKU is available in with the specified + * capabilities. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private List name; + + /* + * A list of capabilities that are available for the SKU in the specified + * list of zones. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /** + * Get the name property: The set of zones that the SKU is available in with the specified capabilities. + * + * @return the name value. + */ + public List name() { + return this.name; + } + + /** + * Get the capabilities property: A list of capabilities that are available for the SKU in the specified list of + * zones. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkus.java new file mode 100644 index 0000000000000..e07fcad0962f1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkus.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceSkus. */ +public interface ResourceSkus { + /** + * Gets the list of Microsoft.Compute SKUs available for your 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 the list of Microsoft.Compute SKUs available for your Subscription. + */ + PagedIterable list(); + + /** + * Gets the list of Microsoft.Compute SKUs available for your Subscription. + * + * @param filter The filter to apply on the operation. Only **location** filter is supported currently. + * @param includeExtendedLocations To Include Extended Locations information or not in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of Microsoft.Compute SKUs available for your Subscription. + */ + PagedIterable list(String filter, String includeExtendedLocations, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkusResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkusResult.java new file mode 100644 index 0000000000000..70e08f018db65 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceSkusResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.ResourceSkuInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Resource Skus operation response. */ +@Fluent +public final class ResourceSkusResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkusResult.class); + + /* + * The list of skus available for the subscription. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of Resource Skus. Call ListNext() with + * this URI to fetch the next page of Resource Skus + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of skus available for the subscription. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of skus available for the subscription. + * + * @param value the value value to set. + * @return the ResourceSkusResult object itself. + */ + public ResourceSkusResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to + * fetch the next page of Resource Skus. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to + * fetch the next page of Resource Skus. + * + * @param nextLink the nextLink value to set. + * @return the ResourceSkusResult object itself. + */ + public ResourceSkusResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ResourceSkusResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceUriList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceUriList.java new file mode 100644 index 0000000000000..36869e3863e68 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ResourceUriList.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List resources which are encrypted with the disk encryption set. */ +@Fluent +public final class ResourceUriList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceUriList.class); + + /* + * A list of IDs or Owner IDs of resources which are encrypted with the + * disk encryption set. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of encrypted resources. Call ListNext() + * with this to fetch the next page of encrypted resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. + * + * @param value the value value to set. + * @return the ResourceUriList object itself. + */ + public ResourceUriList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of encrypted resources. Call ListNext() with this to + * fetch the next page of encrypted resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of encrypted resources. Call ListNext() with this to + * fetch the next page of encrypted resources. + * + * @param nextLink the nextLink value to set. + * @return the ResourceUriList object itself. + */ + public ResourceUriList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ResourceUriList")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoint.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoint.java new file mode 100644 index 0000000000000..cae1318efff57 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoint.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of RestorePoint. */ +public interface RestorePoint { + /** + * 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 excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore + * point. If no disks are specified, all disks will be included. + * + * @return the excludeDisks value. + */ + List excludeDisks(); + + /** + * Gets the sourceMetadata property: Gets the details of the VM captured at the time of the restore point creation. + * + * @return the sourceMetadata value. + */ + RestorePointSourceMetadata sourceMetadata(); + + /** + * Gets the provisioningState property: Gets the provisioning state of the restore point. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the consistencyMode property: Gets the consistency mode for the restore point. Please refer to + * https://aka.ms/RestorePoints for more details. + * + * @return the consistencyMode value. + */ + ConsistencyModeTypes consistencyMode(); + + /** + * Gets the timeCreated property: Gets the creation time of the restore point. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the sourceRestorePoint property: Resource Id of the source restore point from which a copy needs to be + * created. + * + * @return the sourceRestorePoint value. + */ + ApiEntityReference sourceRestorePoint(); + + /** + * Gets the instanceView property: The restore point instance view. + * + * @return the instanceView value. + */ + RestorePointInstanceView instanceView(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner object. + * + * @return the inner object. + */ + RestorePointInner innerModel(); + + /** The entirety of the RestorePoint definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The RestorePoint definition stages. */ + interface DefinitionStages { + /** The first stage of the RestorePoint definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the RestorePoint definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, restorePointCollectionName. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @return the next definition stage. + */ + WithCreate withExistingRestorePointCollection(String resourceGroupName, String restorePointCollectionName); + } + /** + * The stage of the RestorePoint 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.WithExcludeDisks, + DefinitionStages.WithTimeCreated, + DefinitionStages.WithSourceRestorePoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + RestorePoint create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RestorePoint create(Context context); + } + /** The stage of the RestorePoint definition allowing to specify excludeDisks. */ + interface WithExcludeDisks { + /** + * Specifies the excludeDisks property: List of disk resource ids that the customer wishes to exclude from + * the restore point. If no disks are specified, all disks will be included.. + * + * @param excludeDisks List of disk resource ids that the customer wishes to exclude from the restore point. + * If no disks are specified, all disks will be included. + * @return the next definition stage. + */ + WithCreate withExcludeDisks(List excludeDisks); + } + /** The stage of the RestorePoint definition allowing to specify timeCreated. */ + interface WithTimeCreated { + /** + * Specifies the timeCreated property: Gets the creation time of the restore point.. + * + * @param timeCreated Gets the creation time of the restore point. + * @return the next definition stage. + */ + WithCreate withTimeCreated(OffsetDateTime timeCreated); + } + /** The stage of the RestorePoint definition allowing to specify sourceRestorePoint. */ + interface WithSourceRestorePoint { + /** + * Specifies the sourceRestorePoint property: Resource Id of the source restore point from which a copy + * needs to be created.. + * + * @param sourceRestorePoint Resource Id of the source restore point from which a copy needs to be created. + * @return the next definition stage. + */ + WithCreate withSourceRestorePoint(ApiEntityReference sourceRestorePoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RestorePoint refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RestorePoint refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollection.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollection.java new file mode 100644 index 0000000000000..e033f02e1072c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollection.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of RestorePointCollection. */ +public interface RestorePointCollection { + /** + * 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 source property: The properties of the source resource that this restore point collection is created + * from. + * + * @return the source value. + */ + RestorePointCollectionSourceProperties source(); + + /** + * Gets the provisioningState property: The provisioning state of the restore point collection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the restorePointCollectionId property: The unique id of the restore point collection. + * + * @return the restorePointCollectionId value. + */ + String restorePointCollectionId(); + + /** + * Gets the restorePoints property: A list containing all restore points created under this restore point + * collection. + * + * @return the restorePoints value. + */ + List restorePoints(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner object. + * + * @return the inner object. + */ + RestorePointCollectionInner innerModel(); + + /** The entirety of the RestorePointCollection definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The RestorePointCollection definition stages. */ + interface DefinitionStages { + /** The first stage of the RestorePointCollection definition. */ + interface Blank extends WithLocation { + } + /** The stage of the RestorePointCollection 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 RestorePointCollection definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the RestorePointCollection 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.WithSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + RestorePointCollection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RestorePointCollection create(Context context); + } + /** The stage of the RestorePointCollection 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 RestorePointCollection definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: The properties of the source resource that this restore point collection + * is created from.. + * + * @param source The properties of the source resource that this restore point collection is created from. + * @return the next definition stage. + */ + WithCreate withSource(RestorePointCollectionSourceProperties source); + } + } + /** + * Begins update for the RestorePointCollection resource. + * + * @return the stage of resource update. + */ + RestorePointCollection.Update update(); + + /** The template for RestorePointCollection update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RestorePointCollection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RestorePointCollection apply(Context context); + } + /** The RestorePointCollection update stages. */ + interface UpdateStages { + /** The stage of the RestorePointCollection 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 RestorePointCollection update allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: The properties of the source resource that this restore point collection + * is created from.. + * + * @param source The properties of the source resource that this restore point collection is created from. + * @return the next definition stage. + */ + Update withSource(RestorePointCollectionSourceProperties source); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RestorePointCollection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RestorePointCollection refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionExpandOptions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionExpandOptions.java new file mode 100644 index 0000000000000..309a6d4ee4c83 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionExpandOptions.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestorePointCollectionExpandOptions. */ +public final class RestorePointCollectionExpandOptions + extends ExpandableStringEnum { + /** Static value restorePoints for RestorePointCollectionExpandOptions. */ + public static final RestorePointCollectionExpandOptions RESTORE_POINTS = fromString("restorePoints"); + + /** + * Creates or finds a RestorePointCollectionExpandOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestorePointCollectionExpandOptions. + */ + @JsonCreator + public static RestorePointCollectionExpandOptions fromString(String name) { + return fromString(name, RestorePointCollectionExpandOptions.class); + } + + /** @return known RestorePointCollectionExpandOptions values. */ + public static Collection values() { + return values(RestorePointCollectionExpandOptions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionListResult.java new file mode 100644 index 0000000000000..5c7199178f689 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List restore point collection operation response. */ +@Fluent +public final class RestorePointCollectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionListResult.class); + + /* + * Gets the list of restore point collections. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The uri to fetch the next page of RestorePointCollections. Call + * ListNext() with this to fetch the next page of RestorePointCollections + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets the list of restore point collections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets the list of restore point collections. + * + * @param value the value value to set. + * @return the RestorePointCollectionListResult object itself. + */ + public RestorePointCollectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this + * to fetch the next page of RestorePointCollections. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this + * to fetch the next page of RestorePointCollections. + * + * @param nextLink the nextLink value to set. + * @return the RestorePointCollectionListResult object itself. + */ + public RestorePointCollectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionSourceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionSourceProperties.java new file mode 100644 index 0000000000000..bf56212075100 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionSourceProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the source resource that this restore point collection is created from. */ +@Fluent +public final class RestorePointCollectionSourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionSourceProperties.class); + + /* + * Location of the source resource used to create this restore point + * collection. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource Id of the source resource used to create this restore point + * collection + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the location property: Location of the source resource used to create this restore point collection. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the id property: Resource Id of the source resource used to create this restore point collection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id of the source resource used to create this restore point collection. + * + * @param id the id value to set. + * @return the RestorePointCollectionSourceProperties object itself. + */ + public RestorePointCollectionSourceProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionUpdate.java new file mode 100644 index 0000000000000..f7e8ad93a407d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollectionUpdate.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointCollectionProperties; +import com.azure.resourcemanager.compute.generated.fluent.models.RestorePointInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Update Restore Point collection parameters. */ +@Fluent +public final class RestorePointCollectionUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointCollectionUpdate.class); + + /* + * The restore point collection properties. + */ + @JsonProperty(value = "properties") + private RestorePointCollectionProperties innerProperties; + + /** + * Get the innerProperties property: The restore point collection properties. + * + * @return the innerProperties value. + */ + private RestorePointCollectionProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public RestorePointCollectionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @return the source value. + */ + public RestorePointCollectionSourceProperties source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The properties of the source resource that this restore point collection is created + * from. + * + * @param source the source value to set. + * @return the RestorePointCollectionUpdate object itself. + */ + public RestorePointCollectionUpdate withSource(RestorePointCollectionSourceProperties source) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointCollectionProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the restore point collection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the restorePointCollectionId property: The unique id of the restore point collection. + * + * @return the restorePointCollectionId value. + */ + public String restorePointCollectionId() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointCollectionId(); + } + + /** + * Get the restorePoints property: A list containing all restore points created under this restore point collection. + * + * @return the restorePoints value. + */ + public List restorePoints() { + return this.innerProperties() == null ? null : this.innerProperties().restorePoints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollections.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollections.java new file mode 100644 index 0000000000000..6b33c6a701ee1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointCollections.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 RestorePointCollections. */ +public interface RestorePointCollections { + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, Context context); + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters. + */ + RestorePointCollection getByResourceGroup(String resourceGroupName, String restorePointCollectionName); + + /** + * The operation to get the restore point collection. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String restorePointCollectionName, + RestorePointCollectionExpandOptions expand, + Context context); + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the list of restore point collections in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + PagedIterable list(); + + /** + * Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the + * next page of restore point collections. Do this till nextLink is not null to fetch all the restore point + * collections. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of restore point collections in the subscription. + */ + PagedIterable list(Context context); + + /** + * The operation to get the restore point collection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + RestorePointCollection getById(String id); + + /** + * The operation to get the restore point collection. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. If expand=restorePoints, server will return all + * contained restore points in the restorePointCollection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return create or update Restore Point collection parameters along with {@link Response}. + */ + Response getByIdWithResponse( + String id, RestorePointCollectionExpandOptions expand, Context context); + + /** + * The operation to delete the restore point collection. This operation will also delete all the contained restore + * points. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the restore point collection. This operation will also delete all the contained restore + * points. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 RestorePointCollection resource. + * + * @param name resource name. + * @return the first stage of the new RestorePointCollection definition. + */ + RestorePointCollection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointExpandOptions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointExpandOptions.java new file mode 100644 index 0000000000000..38535b80d621a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointExpandOptions.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestorePointExpandOptions. */ +public final class RestorePointExpandOptions extends ExpandableStringEnum { + /** Static value instanceView for RestorePointExpandOptions. */ + public static final RestorePointExpandOptions INSTANCE_VIEW = fromString("instanceView"); + + /** + * Creates or finds a RestorePointExpandOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestorePointExpandOptions. + */ + @JsonCreator + public static RestorePointExpandOptions fromString(String name) { + return fromString(name, RestorePointExpandOptions.class); + } + + /** @return known RestorePointExpandOptions values. */ + public static Collection values() { + return values(RestorePointExpandOptions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointInstanceView.java new file mode 100644 index 0000000000000..0fb62edc765fb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointInstanceView.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a restore point. */ +@Fluent +public final class RestorePointInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointInstanceView.class); + + /* + * The disk restore points information. + */ + @JsonProperty(value = "diskRestorePoints") + private List diskRestorePoints; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the diskRestorePoints property: The disk restore points information. + * + * @return the diskRestorePoints value. + */ + public List diskRestorePoints() { + return this.diskRestorePoints; + } + + /** + * Set the diskRestorePoints property: The disk restore points information. + * + * @param diskRestorePoints the diskRestorePoints value to set. + * @return the RestorePointInstanceView object itself. + */ + public RestorePointInstanceView withDiskRestorePoints(List diskRestorePoints) { + this.diskRestorePoints = diskRestorePoints; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the RestorePointInstanceView object itself. + */ + public RestorePointInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskRestorePoints() != null) { + diskRestorePoints().forEach(e -> e.validate()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceMetadata.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceMetadata.java new file mode 100644 index 0000000000000..d621e98f9fde0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceMetadata.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are + * a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point + * creation. + */ +@Fluent +public final class RestorePointSourceMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointSourceMetadata.class); + + /* + * Gets the hardware profile. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Gets the storage profile. + */ + @JsonProperty(value = "storageProfile") + private RestorePointSourceVMStorageProfile storageProfile; + + /* + * Gets the OS profile. + */ + @JsonProperty(value = "osProfile") + private OSProfile osProfile; + + /* + * Gets the diagnostics profile. + */ + @JsonProperty(value = "diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /* + * Gets the license type, which is for bring your own license scenario. + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * Gets the virtual machine unique id. + */ + @JsonProperty(value = "vmId") + private String vmId; + + /* + * Gets the security profile. + */ + @JsonProperty(value = "securityProfile") + private SecurityProfile securityProfile; + + /* + * Location of the VM from which the restore point was created. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the hardwareProfile property: Gets the hardware profile. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Gets the hardware profile. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Gets the storage profile. + * + * @return the storageProfile value. + */ + public RestorePointSourceVMStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Gets the storage profile. + * + * @param storageProfile the storageProfile value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withStorageProfile(RestorePointSourceVMStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the osProfile property: Gets the OS profile. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Gets the OS profile. + * + * @param osProfile the osProfile value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the diagnosticsProfile property: Gets the diagnostics profile. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: Gets the diagnostics profile. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the licenseType property: Gets the license type, which is for bring your own license scenario. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Gets the license type, which is for bring your own license scenario. + * + * @param licenseType the licenseType value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vmId property: Gets the virtual machine unique id. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Gets the virtual machine unique id. + * + * @param vmId the vmId value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the securityProfile property: Gets the security profile. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Gets the security profile. + * + * @param securityProfile the securityProfile value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the location property: Location of the VM from which the restore point was created. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the VM from which the restore point was created. + * + * @param location the location value to set. + * @return the RestorePointSourceMetadata object itself. + */ + public RestorePointSourceMetadata withLocation(String location) { + this.location = location; + 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 (osProfile() != null) { + osProfile().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMDataDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMDataDisk.java new file mode 100644 index 0000000000000..1706d47ffed78 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMDataDisk.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a data disk. */ +@Fluent +public final class RestorePointSourceVMDataDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointSourceVMDataDisk.class); + + /* + * Gets the logical unit number. + */ + @JsonProperty(value = "lun") + private Integer lun; + + /* + * Gets the disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the caching type. + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Gets the initial disk size in GB for blank data disks, and the new + * desired size for existing OS and Data disks. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets the managed disk details + */ + @JsonProperty(value = "managedDisk") + private ManagedDiskParameters managedDisk; + + /* + * Gets the disk restore point Id. + */ + @JsonProperty(value = "diskRestorePoint") + private ApiEntityReference diskRestorePoint; + + /** + * Get the lun property: Gets the logical unit number. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Set the lun property: Gets the logical unit number. + * + * @param lun the lun value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withLun(Integer lun) { + this.lun = lun; + return this; + } + + /** + * Get the name property: Gets the disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets the disk name. + * + * @param name the name value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the caching property: Gets the caching type. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Gets the caching type. + * + * @param caching the caching value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the diskSizeGB property: Gets the initial disk size in GB for blank data disks, and the new desired size for + * existing OS and Data disks. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Gets the initial disk size in GB for blank data disks, and the new desired size for + * existing OS and Data disks. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: Gets the managed disk details. + * + * @return the managedDisk value. + */ + public ManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: Gets the managed disk details. + * + * @param managedDisk the managedDisk value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withManagedDisk(ManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the diskRestorePoint property: Gets the disk restore point Id. + * + * @return the diskRestorePoint value. + */ + public ApiEntityReference diskRestorePoint() { + return this.diskRestorePoint; + } + + /** + * Set the diskRestorePoint property: Gets the disk restore point Id. + * + * @param diskRestorePoint the diskRestorePoint value to set. + * @return the RestorePointSourceVMDataDisk object itself. + */ + public RestorePointSourceVMDataDisk withDiskRestorePoint(ApiEntityReference diskRestorePoint) { + this.diskRestorePoint = diskRestorePoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managedDisk() != null) { + managedDisk().validate(); + } + if (diskRestorePoint() != null) { + diskRestorePoint().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMStorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMStorageProfile.java new file mode 100644 index 0000000000000..a0fe32f4f213f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVMStorageProfile.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the storage profile. */ +@Fluent +public final class RestorePointSourceVMStorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointSourceVMStorageProfile.class); + + /* + * Gets the OS disk of the VM captured at the time of the restore point + * creation. + */ + @JsonProperty(value = "osDisk") + private RestorePointSourceVmosDisk osDisk; + + /* + * Gets the data disks of the VM captured at the time of the restore point + * creation. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get the osDisk property: Gets the OS disk of the VM captured at the time of the restore point creation. + * + * @return the osDisk value. + */ + public RestorePointSourceVmosDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: Gets the OS disk of the VM captured at the time of the restore point creation. + * + * @param osDisk the osDisk value to set. + * @return the RestorePointSourceVMStorageProfile object itself. + */ + public RestorePointSourceVMStorageProfile withOsDisk(RestorePointSourceVmosDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: Gets the data disks of the VM captured at the time of the restore point creation. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Gets the data disks of the VM captured at the time of the restore point creation. + * + * @param dataDisks the dataDisks value to set. + * @return the RestorePointSourceVMStorageProfile object itself. + */ + public RestorePointSourceVMStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVmosDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVmosDisk.java new file mode 100644 index 0000000000000..e9c24d723e533 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePointSourceVmosDisk.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an Operating System disk. */ +@Fluent +public final class RestorePointSourceVmosDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointSourceVmosDisk.class); + + /* + * Gets the Operating System type. + */ + @JsonProperty(value = "osType") + private OperatingSystemType osType; + + /* + * Gets the disk encryption settings. + */ + @JsonProperty(value = "encryptionSettings") + private DiskEncryptionSettings encryptionSettings; + + /* + * Gets the disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the caching type. + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Gets the disk size in GB. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets the managed disk details + */ + @JsonProperty(value = "managedDisk") + private ManagedDiskParameters managedDisk; + + /* + * Gets the disk restore point Id. + */ + @JsonProperty(value = "diskRestorePoint") + private ApiEntityReference diskRestorePoint; + + /** + * Get the osType property: Gets the Operating System type. + * + * @return the osType value. + */ + public OperatingSystemType osType() { + return this.osType; + } + + /** + * Set the osType property: Gets the Operating System type. + * + * @param osType the osType value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withOsType(OperatingSystemType osType) { + this.osType = osType; + return this; + } + + /** + * Get the encryptionSettings property: Gets the disk encryption settings. + * + * @return the encryptionSettings value. + */ + public DiskEncryptionSettings encryptionSettings() { + return this.encryptionSettings; + } + + /** + * Set the encryptionSettings property: Gets the disk encryption settings. + * + * @param encryptionSettings the encryptionSettings value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withEncryptionSettings(DiskEncryptionSettings encryptionSettings) { + this.encryptionSettings = encryptionSettings; + return this; + } + + /** + * Get the name property: Gets the disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets the disk name. + * + * @param name the name value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the caching property: Gets the caching type. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Gets the caching type. + * + * @param caching the caching value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the diskSizeGB property: Gets the disk size in GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Gets the disk size in GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: Gets the managed disk details. + * + * @return the managedDisk value. + */ + public ManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: Gets the managed disk details. + * + * @param managedDisk the managedDisk value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withManagedDisk(ManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the diskRestorePoint property: Gets the disk restore point Id. + * + * @return the diskRestorePoint value. + */ + public ApiEntityReference diskRestorePoint() { + return this.diskRestorePoint; + } + + /** + * Set the diskRestorePoint property: Gets the disk restore point Id. + * + * @param diskRestorePoint the diskRestorePoint value to set. + * @return the RestorePointSourceVmosDisk object itself. + */ + public RestorePointSourceVmosDisk withDiskRestorePoint(ApiEntityReference diskRestorePoint) { + this.diskRestorePoint = diskRestorePoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryptionSettings() != null) { + encryptionSettings().validate(); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + if (diskRestorePoint() != null) { + diskRestorePoint().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoints.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoints.java new file mode 100644 index 0000000000000..2d4ce5ebb2435 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RestorePoints.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorePoints. */ +public interface RestorePoints { + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, String restorePointName); + + /** + * The operation to delete the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the Restore Point Collection. + * @param restorePointName The name of the restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 restorePointCollectionName, String restorePointName, Context context); + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details. + */ + RestorePoint get(String resourceGroupName, String restorePointCollectionName, String restorePointName); + + /** + * The operation to get the restore point. + * + * @param resourceGroupName The name of the resource group. + * @param restorePointCollectionName The name of the restore point collection. + * @param restorePointName The name of the restore point. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String restorePointCollectionName, + String restorePointName, + RestorePointExpandOptions expand, + Context context); + + /** + * The operation to get the restore point. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response}. + */ + RestorePoint getById(String id); + + /** + * The operation to get the restore point. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves information about the + * run-time state of a restore point. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore Point details along with {@link Response}. + */ + Response getByIdWithResponse(String id, RestorePointExpandOptions expand, Context context); + + /** + * The operation to delete the restore point. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the restore point. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 RestorePoint resource. + * + * @param name resource name. + * @return the first stage of the new RestorePoint definition. + */ + RestorePoint.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RetrieveBootDiagnosticsDataResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RetrieveBootDiagnosticsDataResult.java new file mode 100644 index 0000000000000..a5e5d34634cf8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RetrieveBootDiagnosticsDataResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner; + +/** An immutable client-side representation of RetrieveBootDiagnosticsDataResult. */ +public interface RetrieveBootDiagnosticsDataResult { + /** + * Gets the consoleScreenshotBlobUri property: The console screenshot blob URI. + * + * @return the consoleScreenshotBlobUri value. + */ + String consoleScreenshotBlobUri(); + + /** + * Gets the serialConsoleLogBlobUri property: The serial console log blob URI. + * + * @return the serialConsoleLogBlobUri value. + */ + String serialConsoleLogBlobUri(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RetrieveBootDiagnosticsDataResultInner + * object. + * + * @return the inner object. + */ + RetrieveBootDiagnosticsDataResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstance.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstance.java new file mode 100644 index 0000000000000..7ab22b5772a9d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstance.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import java.util.Map; + +/** An immutable client-side representation of RoleInstance. */ +public interface RoleInstance { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource Name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource Type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource Location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The sku property. + * + * @return the sku value. + */ + InstanceSku sku(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + RoleInstanceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner object. + * + * @return the inner object. + */ + RoleInstanceInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceListResult.java new file mode 100644 index 0000000000000..b47919bd2ef2c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The RoleInstanceListResult model. */ +@Fluent +public final class RoleInstanceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstanceListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the RoleInstanceListResult object itself. + */ + public RoleInstanceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the RoleInstanceListResult object itself. + */ + public RoleInstanceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model RoleInstanceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceNetworkProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceNetworkProfile.java new file mode 100644 index 0000000000000..f30a392edc144 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceNetworkProfile.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the network profile for the role instance. */ +@Immutable +public final class RoleInstanceNetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstanceNetworkProfile.class); + + /* + * Specifies the list of resource Ids for the network interfaces associated + * with the role instance. + */ + @JsonProperty(value = "networkInterfaces", access = JsonProperty.Access.WRITE_ONLY) + private List networkInterfaces; + + /** + * Get the networkInterfaces property: Specifies the list of resource Ids for the network interfaces associated with + * the role instance. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceProperties.java new file mode 100644 index 0000000000000..5fe29b9f1d2c7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceProperties.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstancePropertiesInner; + +/** An immutable client-side representation of RoleInstanceProperties. */ +public interface RoleInstanceProperties { + /** + * Gets the networkProfile property: Describes the network profile for the role instance. + * + * @return the networkProfile value. + */ + RoleInstanceNetworkProfile networkProfile(); + + /** + * Gets the instanceView property: The instance view of the role instance. + * + * @return the instanceView value. + */ + RoleInstanceView instanceView(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RoleInstancePropertiesInner object. + * + * @return the inner object. + */ + RoleInstancePropertiesInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceView.java new file mode 100644 index 0000000000000..9018d06fe96f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstanceView.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner; +import java.util.List; + +/** An immutable client-side representation of RoleInstanceView. */ +public interface RoleInstanceView { + /** + * Gets the platformUpdateDomain property: The Update Domain. + * + * @return the platformUpdateDomain value. + */ + Integer platformUpdateDomain(); + + /** + * Gets the platformFaultDomain property: The Fault Domain. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the privateId property: Specifies a unique identifier generated internally for the cloud service associated + * with this role instance. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this + * property can be used as 'DeploymentId' for querying details. + * + * @return the privateId value. + */ + String privateId(); + + /** + * Gets the statuses property: The statuses property. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RoleInstanceViewInner object. + * + * @return the inner object. + */ + RoleInstanceViewInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstances.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstances.java new file mode 100644 index 0000000000000..19d1e4a587bb3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RoleInstances.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies a list of role instances from the cloud service. */ +@Fluent +public final class RoleInstances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleInstances.class); + + /* + * List of cloud service role instance names. Value of '*' will signify all + * role instances of the cloud service. + */ + @JsonProperty(value = "roleInstances", required = true) + private List roleInstances; + + /** + * Get the roleInstances property: List of cloud service role instance names. Value of '*' will signify all role + * instances of the cloud service. + * + * @return the roleInstances value. + */ + public List roleInstances() { + return this.roleInstances; + } + + /** + * Set the roleInstances property: List of cloud service role instance names. Value of '*' will signify all role + * instances of the cloud service. + * + * @param roleInstances the roleInstances value to set. + * @return the RoleInstances object itself. + */ + public RoleInstances withRoleInstances(List roleInstances) { + this.roleInstances = roleInstances; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roleInstances() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property roleInstances in model RoleInstances")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollbackStatusInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollbackStatusInfo.java new file mode 100644 index 0000000000000..e327989edb836 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollbackStatusInfo.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about rollback on failed VM instances after a OS Upgrade operation. */ +@Immutable +public final class RollbackStatusInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollbackStatusInfo.class); + + /* + * The number of instances which have been successfully rolled back. + */ + @JsonProperty(value = "successfullyRolledbackInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer successfullyRolledbackInstanceCount; + + /* + * The number of instances which failed to rollback. + */ + @JsonProperty(value = "failedRolledbackInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedRolledbackInstanceCount; + + /* + * Error details if OS rollback failed. + */ + @JsonProperty(value = "rollbackError", access = JsonProperty.Access.WRITE_ONLY) + private ApiError rollbackError; + + /** + * Get the successfullyRolledbackInstanceCount property: The number of instances which have been successfully rolled + * back. + * + * @return the successfullyRolledbackInstanceCount value. + */ + public Integer successfullyRolledbackInstanceCount() { + return this.successfullyRolledbackInstanceCount; + } + + /** + * Get the failedRolledbackInstanceCount property: The number of instances which failed to rollback. + * + * @return the failedRolledbackInstanceCount value. + */ + public Integer failedRolledbackInstanceCount() { + return this.failedRolledbackInstanceCount; + } + + /** + * Get the rollbackError property: Error details if OS rollback failed. + * + * @return the rollbackError value. + */ + public ApiError rollbackError() { + return this.rollbackError; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rollbackError() != null) { + rollbackError().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeActionType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeActionType.java new file mode 100644 index 0000000000000..0f4475a50fba2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeActionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RollingUpgradeActionType. */ +public enum RollingUpgradeActionType { + /** Enum value Start. */ + START("Start"), + + /** Enum value Cancel. */ + CANCEL("Cancel"); + + /** The actual serialized value for a RollingUpgradeActionType instance. */ + private final String value; + + RollingUpgradeActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RollingUpgradeActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed RollingUpgradeActionType object, or null if unable to parse. + */ + @JsonCreator + public static RollingUpgradeActionType fromString(String value) { + RollingUpgradeActionType[] items = RollingUpgradeActionType.values(); + for (RollingUpgradeActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradePolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradePolicy.java new file mode 100644 index 0000000000000..56aecaba87c00 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradePolicy.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The configuration parameters used while performing a rolling upgrade. */ +@Fluent +public final class RollingUpgradePolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollingUpgradePolicy.class); + + /* + * The maximum percent of total virtual machine instances that will be + * upgraded simultaneously by the rolling upgrade in one batch. As this is + * a maximum, unhealthy instances in previous or future batches can cause + * the percentage of instances in a batch to decrease to ensure higher + * reliability. The default value for this parameter is 20%. + */ + @JsonProperty(value = "maxBatchInstancePercent") + private Integer maxBatchInstancePercent; + + /* + * The maximum percentage of the total virtual machine instances in the + * scale set that can be simultaneously unhealthy, either as a result of + * being upgraded, or by being found in an unhealthy state by the virtual + * machine health checks before the rolling upgrade aborts. This constraint + * will be checked prior to starting any batch. The default value for this + * parameter is 20%. + */ + @JsonProperty(value = "maxUnhealthyInstancePercent") + private Integer maxUnhealthyInstancePercent; + + /* + * The maximum percentage of upgraded virtual machine instances that can be + * found to be in an unhealthy state. This check will happen after each + * batch is upgraded. If this percentage is ever exceeded, the rolling + * update aborts. The default value for this parameter is 20%. + */ + @JsonProperty(value = "maxUnhealthyUpgradedInstancePercent") + private Integer maxUnhealthyUpgradedInstancePercent; + + /* + * The wait time between completing the update for all virtual machines in + * one batch and starting the next batch. The time duration should be + * specified in ISO 8601 format. The default value is 0 seconds (PT0S). + */ + @JsonProperty(value = "pauseTimeBetweenBatches") + private String pauseTimeBetweenBatches; + + /* + * Allow VMSS to ignore AZ boundaries when constructing upgrade batches. + * Take into consideration the Update Domain and maxBatchInstancePercent to + * determine the batch size. + */ + @JsonProperty(value = "enableCrossZoneUpgrade") + private Boolean enableCrossZoneUpgrade; + + /* + * Upgrade all unhealthy instances in a scale set before any healthy + * instances. + */ + @JsonProperty(value = "prioritizeUnhealthyInstances") + private Boolean prioritizeUnhealthyInstances; + + /** + * Get the maxBatchInstancePercent property: The maximum percent of total virtual machine instances that will be + * upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in + * previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher + * reliability. The default value for this parameter is 20%. + * + * @return the maxBatchInstancePercent value. + */ + public Integer maxBatchInstancePercent() { + return this.maxBatchInstancePercent; + } + + /** + * Set the maxBatchInstancePercent property: The maximum percent of total virtual machine instances that will be + * upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in + * previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher + * reliability. The default value for this parameter is 20%. + * + * @param maxBatchInstancePercent the maxBatchInstancePercent value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withMaxBatchInstancePercent(Integer maxBatchInstancePercent) { + this.maxBatchInstancePercent = maxBatchInstancePercent; + return this; + } + + /** + * Get the maxUnhealthyInstancePercent property: The maximum percentage of the total virtual machine instances in + * the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an + * unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be + * checked prior to starting any batch. The default value for this parameter is 20%. + * + * @return the maxUnhealthyInstancePercent value. + */ + public Integer maxUnhealthyInstancePercent() { + return this.maxUnhealthyInstancePercent; + } + + /** + * Set the maxUnhealthyInstancePercent property: The maximum percentage of the total virtual machine instances in + * the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an + * unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be + * checked prior to starting any batch. The default value for this parameter is 20%. + * + * @param maxUnhealthyInstancePercent the maxUnhealthyInstancePercent value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withMaxUnhealthyInstancePercent(Integer maxUnhealthyInstancePercent) { + this.maxUnhealthyInstancePercent = maxUnhealthyInstancePercent; + return this; + } + + /** + * Get the maxUnhealthyUpgradedInstancePercent property: The maximum percentage of upgraded virtual machine + * instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If + * this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. + * + * @return the maxUnhealthyUpgradedInstancePercent value. + */ + public Integer maxUnhealthyUpgradedInstancePercent() { + return this.maxUnhealthyUpgradedInstancePercent; + } + + /** + * Set the maxUnhealthyUpgradedInstancePercent property: The maximum percentage of upgraded virtual machine + * instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If + * this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. + * + * @param maxUnhealthyUpgradedInstancePercent the maxUnhealthyUpgradedInstancePercent value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withMaxUnhealthyUpgradedInstancePercent(Integer maxUnhealthyUpgradedInstancePercent) { + this.maxUnhealthyUpgradedInstancePercent = maxUnhealthyUpgradedInstancePercent; + return this; + } + + /** + * Get the pauseTimeBetweenBatches property: The wait time between completing the update for all virtual machines in + * one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default + * value is 0 seconds (PT0S). + * + * @return the pauseTimeBetweenBatches value. + */ + public String pauseTimeBetweenBatches() { + return this.pauseTimeBetweenBatches; + } + + /** + * Set the pauseTimeBetweenBatches property: The wait time between completing the update for all virtual machines in + * one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default + * value is 0 seconds (PT0S). + * + * @param pauseTimeBetweenBatches the pauseTimeBetweenBatches value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withPauseTimeBetweenBatches(String pauseTimeBetweenBatches) { + this.pauseTimeBetweenBatches = pauseTimeBetweenBatches; + return this; + } + + /** + * Get the enableCrossZoneUpgrade property: Allow VMSS to ignore AZ boundaries when constructing upgrade batches. + * Take into consideration the Update Domain and maxBatchInstancePercent to determine the batch size. + * + * @return the enableCrossZoneUpgrade value. + */ + public Boolean enableCrossZoneUpgrade() { + return this.enableCrossZoneUpgrade; + } + + /** + * Set the enableCrossZoneUpgrade property: Allow VMSS to ignore AZ boundaries when constructing upgrade batches. + * Take into consideration the Update Domain and maxBatchInstancePercent to determine the batch size. + * + * @param enableCrossZoneUpgrade the enableCrossZoneUpgrade value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withEnableCrossZoneUpgrade(Boolean enableCrossZoneUpgrade) { + this.enableCrossZoneUpgrade = enableCrossZoneUpgrade; + return this; + } + + /** + * Get the prioritizeUnhealthyInstances property: Upgrade all unhealthy instances in a scale set before any healthy + * instances. + * + * @return the prioritizeUnhealthyInstances value. + */ + public Boolean prioritizeUnhealthyInstances() { + return this.prioritizeUnhealthyInstances; + } + + /** + * Set the prioritizeUnhealthyInstances property: Upgrade all unhealthy instances in a scale set before any healthy + * instances. + * + * @param prioritizeUnhealthyInstances the prioritizeUnhealthyInstances value to set. + * @return the RollingUpgradePolicy object itself. + */ + public RollingUpgradePolicy withPrioritizeUnhealthyInstances(Boolean prioritizeUnhealthyInstances) { + this.prioritizeUnhealthyInstances = prioritizeUnhealthyInstances; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeProgressInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeProgressInfo.java new file mode 100644 index 0000000000000..904abc23d9c43 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeProgressInfo.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the number of virtual machine instances in each upgrade state. */ +@Immutable +public final class RollingUpgradeProgressInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollingUpgradeProgressInfo.class); + + /* + * The number of instances that have been successfully upgraded. + */ + @JsonProperty(value = "successfulInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer successfulInstanceCount; + + /* + * The number of instances that have failed to be upgraded successfully. + */ + @JsonProperty(value = "failedInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer failedInstanceCount; + + /* + * The number of instances that are currently being upgraded. + */ + @JsonProperty(value = "inProgressInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer inProgressInstanceCount; + + /* + * The number of instances that have not yet begun to be upgraded. + */ + @JsonProperty(value = "pendingInstanceCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer pendingInstanceCount; + + /** + * Get the successfulInstanceCount property: The number of instances that have been successfully upgraded. + * + * @return the successfulInstanceCount value. + */ + public Integer successfulInstanceCount() { + return this.successfulInstanceCount; + } + + /** + * Get the failedInstanceCount property: The number of instances that have failed to be upgraded successfully. + * + * @return the failedInstanceCount value. + */ + public Integer failedInstanceCount() { + return this.failedInstanceCount; + } + + /** + * Get the inProgressInstanceCount property: The number of instances that are currently being upgraded. + * + * @return the inProgressInstanceCount value. + */ + public Integer inProgressInstanceCount() { + return this.inProgressInstanceCount; + } + + /** + * Get the pendingInstanceCount property: The number of instances that have not yet begun to be upgraded. + * + * @return the pendingInstanceCount value. + */ + public Integer pendingInstanceCount() { + return this.pendingInstanceCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeRunningStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeRunningStatus.java new file mode 100644 index 0000000000000..e8fd4c89ee73a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeRunningStatus.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Information about the current running state of the overall upgrade. */ +@Immutable +public final class RollingUpgradeRunningStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RollingUpgradeRunningStatus.class); + + /* + * Code indicating the current status of the upgrade. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeStatusCode code; + + /* + * Start time of the upgrade. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The last action performed on the rolling upgrade. + */ + @JsonProperty(value = "lastAction", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeActionType lastAction; + + /* + * Last action time of the upgrade. + */ + @JsonProperty(value = "lastActionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastActionTime; + + /** + * Get the code property: Code indicating the current status of the upgrade. + * + * @return the code value. + */ + public RollingUpgradeStatusCode code() { + return this.code; + } + + /** + * Get the startTime property: Start time of the upgrade. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the lastAction property: The last action performed on the rolling upgrade. + * + * @return the lastAction value. + */ + public RollingUpgradeActionType lastAction() { + return this.lastAction; + } + + /** + * Get the lastActionTime property: Last action time of the upgrade. + * + * @return the lastActionTime value. + */ + public OffsetDateTime lastActionTime() { + return this.lastActionTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusCode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusCode.java new file mode 100644 index 0000000000000..a10151a61ecee --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusCode.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RollingUpgradeStatusCode. */ +public enum RollingUpgradeStatusCode { + /** Enum value RollingForward. */ + ROLLING_FORWARD("RollingForward"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"), + + /** Enum value Completed. */ + COMPLETED("Completed"), + + /** Enum value Faulted. */ + FAULTED("Faulted"); + + /** The actual serialized value for a RollingUpgradeStatusCode instance. */ + private final String value; + + RollingUpgradeStatusCode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RollingUpgradeStatusCode instance. + * + * @param value the serialized value to parse. + * @return the parsed RollingUpgradeStatusCode object, or null if unable to parse. + */ + @JsonCreator + public static RollingUpgradeStatusCode fromString(String value) { + RollingUpgradeStatusCode[] items = RollingUpgradeStatusCode.values(); + for (RollingUpgradeStatusCode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusInfo.java new file mode 100644 index 0000000000000..e4561fff1a369 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RollingUpgradeStatusInfo.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RollingUpgradeStatusInfoInner; +import java.util.Map; + +/** An immutable client-side representation of RollingUpgradeStatusInfo. */ +public interface RollingUpgradeStatusInfo { + /** + * 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 policy property: The rolling upgrade policies applied for this upgrade. + * + * @return the policy value. + */ + RollingUpgradePolicy policy(); + + /** + * Gets the runningStatus property: Information about the current running state of the overall upgrade. + * + * @return the runningStatus value. + */ + RollingUpgradeRunningStatus runningStatus(); + + /** + * Gets the progress property: Information about the number of virtual machine instances in each upgrade state. + * + * @return the progress value. + */ + RollingUpgradeProgressInfo progress(); + + /** + * Gets the error property: Error details for this upgrade, if there are any. + * + * @return the error value. + */ + ApiError error(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RollingUpgradeStatusInfoInner object. + * + * @return the inner object. + */ + RollingUpgradeStatusInfoInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocument.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocument.java new file mode 100644 index 0000000000000..b2dd93266888f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocument.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner; +import java.util.List; + +/** An immutable client-side representation of RunCommandDocument. */ +public interface RunCommandDocument { + /** + * Gets the schema property: The VM run command schema. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the id property: The VM run command id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the osType property: The Operating System type. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the label property: The VM run command label. + * + * @return the label value. + */ + String label(); + + /** + * Gets the description property: The VM run command description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the script property: The script to be executed. + * + * @return the script value. + */ + List script(); + + /** + * Gets the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + List parameters(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentInner object. + * + * @return the inner object. + */ + RunCommandDocumentInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocumentBase.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocumentBase.java new file mode 100644 index 0000000000000..a48e0629fd9c5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandDocumentBase.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner; + +/** An immutable client-side representation of RunCommandDocumentBase. */ +public interface RunCommandDocumentBase { + /** + * Gets the schema property: The VM run command schema. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the id property: The VM run command id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the osType property: The Operating System type. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the label property: The VM run command label. + * + * @return the label value. + */ + String label(); + + /** + * Gets the description property: The VM run command description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner object. + * + * @return the inner object. + */ + RunCommandDocumentBaseInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInput.java new file mode 100644 index 0000000000000..ed850108402cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInput.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Capture Virtual Machine parameters. */ +@Fluent +public final class RunCommandInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandInput.class); + + /* + * The run command id. + */ + @JsonProperty(value = "commandId", required = true) + private String commandId; + + /* + * Optional. The script to be executed. When this value is given, the + * given script will override the default script of the command. + */ + @JsonProperty(value = "script") + private List script; + + /* + * The run command parameters. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * Get the commandId property: The run command id. + * + * @return the commandId value. + */ + public String commandId() { + return this.commandId; + } + + /** + * Set the commandId property: The run command id. + * + * @param commandId the commandId value to set. + * @return the RunCommandInput object itself. + */ + public RunCommandInput withCommandId(String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Get the script property: Optional. The script to be executed. When this value is given, the given script will + * override the default script of the command. + * + * @return the script value. + */ + public List script() { + return this.script; + } + + /** + * Set the script property: Optional. The script to be executed. When this value is given, the given script will + * override the default script of the command. + * + * @param script the script value to set. + * @return the RunCommandInput object itself. + */ + public RunCommandInput withScript(List script) { + this.script = script; + return this; + } + + /** + * Get the parameters property: The run command parameters. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The run command parameters. + * + * @param parameters the parameters value to set. + * @return the RunCommandInput object itself. + */ + public RunCommandInput withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (commandId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property commandId in model RunCommandInput")); + } + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInputParameter.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInputParameter.java new file mode 100644 index 0000000000000..3ab22547e1ab6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandInputParameter.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a run command parameter. */ +@Fluent +public final class RunCommandInputParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandInputParameter.class); + + /* + * The run command parameter name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The run command parameter value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: The run command parameter name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The run command parameter name. + * + * @param name the name value to set. + * @return the RunCommandInputParameter object itself. + */ + public RunCommandInputParameter withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The run command parameter value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The run command parameter value. + * + * @param value the value value to set. + * @return the RunCommandInputParameter object itself. + */ + public RunCommandInputParameter withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model RunCommandInputParameter")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model RunCommandInputParameter")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandListResult.java new file mode 100644 index 0000000000000..ac7e3f9bf185a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandDocumentBaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine operation response. */ +@Fluent +public final class RunCommandListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandListResult.class); + + /* + * The list of virtual machine run commands. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of run commands. Call ListNext() with + * this to fetch the next page of run commands. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of virtual machine run commands. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machine run commands. + * + * @param value the value value to set. + * @return the RunCommandListResult object itself. + */ + public RunCommandListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of run commands. Call ListNext() with this to fetch the + * next page of run commands. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of run commands. Call ListNext() with this to fetch the + * next page of run commands. + * + * @param nextLink the nextLink value to set. + * @return the RunCommandListResult object itself. + */ + public RunCommandListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model RunCommandListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandParameterDefinition.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandParameterDefinition.java new file mode 100644 index 0000000000000..54714154ce7f9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandParameterDefinition.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a run command parameter. */ +@Fluent +public final class RunCommandParameterDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunCommandParameterDefinition.class); + + /* + * The run command parameter name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The run command parameter type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * The run command parameter default value. + */ + @JsonProperty(value = "defaultValue") + private String defaultValue; + + /* + * The run command parameter required. + */ + @JsonProperty(value = "required") + private Boolean required; + + /** + * Get the name property: The run command parameter name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The run command parameter name. + * + * @param name the name value to set. + * @return the RunCommandParameterDefinition object itself. + */ + public RunCommandParameterDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The run command parameter type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The run command parameter type. + * + * @param type the type value to set. + * @return the RunCommandParameterDefinition object itself. + */ + public RunCommandParameterDefinition withType(String type) { + this.type = type; + return this; + } + + /** + * Get the defaultValue property: The run command parameter default value. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Set the defaultValue property: The run command parameter default value. + * + * @param defaultValue the defaultValue value to set. + * @return the RunCommandParameterDefinition object itself. + */ + public RunCommandParameterDefinition withDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get the required property: The run command parameter required. + * + * @return the required value. + */ + public Boolean required() { + return this.required; + } + + /** + * Set the required property: The run command parameter required. + * + * @param required the required value to set. + * @return the RunCommandParameterDefinition object itself. + */ + public RunCommandParameterDefinition withRequired(Boolean required) { + this.required = required; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model RunCommandParameterDefinition")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model RunCommandParameterDefinition")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandResult.java new file mode 100644 index 0000000000000..9b84e3c981d0f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/RunCommandResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner; +import java.util.List; + +/** An immutable client-side representation of RunCommandResult. */ +public interface RunCommandResult { + /** + * Gets the value property: Run command operation response. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.RunCommandResultInner object. + * + * @return the inner object. + */ + RunCommandResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScaleInPolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScaleInPolicy.java new file mode 100644 index 0000000000000..bf63f3497086a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScaleInPolicy.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a scale-in policy for a virtual machine scale set. */ +@Fluent +public final class ScaleInPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleInPolicy.class); + + /* + * The rules to be followed when scaling-in a virtual machine scale set. + *

    Possible values are:

    **Default** When a virtual + * machine scale set is scaled in, the scale set will first be balanced + * across zones if it is a zonal scale set. Then, it will be balanced + * across Fault Domains as far as possible. Within each Fault Domain, the + * virtual machines chosen for removal will be the newest ones that are not + * protected from scale-in.

    **OldestVM** When a virtual machine + * scale set is being scaled-in, the oldest virtual machines that are not + * protected from scale-in will be chosen for removal. For zonal virtual + * machine scale sets, the scale set will first be balanced across zones. + * Within each zone, the oldest virtual machines that are not protected + * will be chosen for removal.

    **NewestVM** When a virtual machine + * scale set is being scaled-in, the newest virtual machines that are not + * protected from scale-in will be chosen for removal. For zonal virtual + * machine scale sets, the scale set will first be balanced across zones. + * Within each zone, the newest virtual machines that are not protected + * will be chosen for removal.

    + */ + @JsonProperty(value = "rules") + private List rules; + + /* + * This property allows you to specify if virtual machines chosen for + * removal have to be force deleted when a virtual machine scale set is + * being scaled-in.(Feature in Preview) + */ + @JsonProperty(value = "forceDeletion") + private Boolean forceDeletion; + + /** + * Get the rules property: The rules to be followed when scaling-in a virtual machine scale set. + * <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is + * scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be + * balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for + * removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a + * virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in + * will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across + * zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. + * <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual + * machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, + * the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not + * protected will be chosen for removal. <br><br>. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: The rules to be followed when scaling-in a virtual machine scale set. + * <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is + * scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be + * balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for + * removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a + * virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in + * will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across + * zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. + * <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual + * machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, + * the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not + * protected will be chosen for removal. <br><br>. + * + * @param rules the rules value to set. + * @return the ScaleInPolicy object itself. + */ + public ScaleInPolicy withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have + * to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview). + * + * @return the forceDeletion value. + */ + public Boolean forceDeletion() { + return this.forceDeletion; + } + + /** + * Set the forceDeletion property: This property allows you to specify if virtual machines chosen for removal have + * to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview). + * + * @param forceDeletion the forceDeletion value to set. + * @return the ScaleInPolicy object itself. + */ + public ScaleInPolicy withForceDeletion(Boolean forceDeletion) { + this.forceDeletion = forceDeletion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScheduledEventsProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScheduledEventsProfile.java new file mode 100644 index 0000000000000..105e6832c72b9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ScheduledEventsProfile.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ScheduledEventsProfile model. */ +@Fluent +public final class ScheduledEventsProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduledEventsProfile.class); + + /* + * Specifies Terminate Scheduled Event related configurations. + */ + @JsonProperty(value = "terminateNotificationProfile") + private TerminateNotificationProfile terminateNotificationProfile; + + /** + * Get the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations. + * + * @return the terminateNotificationProfile value. + */ + public TerminateNotificationProfile terminateNotificationProfile() { + return this.terminateNotificationProfile; + } + + /** + * Set the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations. + * + * @param terminateNotificationProfile the terminateNotificationProfile value to set. + * @return the ScheduledEventsProfile object itself. + */ + public ScheduledEventsProfile withTerminateNotificationProfile( + TerminateNotificationProfile terminateNotificationProfile) { + this.terminateNotificationProfile = terminateNotificationProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (terminateNotificationProfile() != null) { + terminateNotificationProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityEncryptionTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityEncryptionTypes.java new file mode 100644 index 0000000000000..47e758aacbc6a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityEncryptionTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityEncryptionTypes. */ +public final class SecurityEncryptionTypes extends ExpandableStringEnum { + /** Static value VMGuestStateOnly for SecurityEncryptionTypes. */ + public static final SecurityEncryptionTypes VMGUEST_STATE_ONLY = fromString("VMGuestStateOnly"); + + /** Static value DiskWithVMGuestState for SecurityEncryptionTypes. */ + public static final SecurityEncryptionTypes DISK_WITH_VMGUEST_STATE = fromString("DiskWithVMGuestState"); + + /** + * Creates or finds a SecurityEncryptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityEncryptionTypes. + */ + @JsonCreator + public static SecurityEncryptionTypes fromString(String name) { + return fromString(name, SecurityEncryptionTypes.class); + } + + /** @return known SecurityEncryptionTypes values. */ + public static Collection values() { + return values(SecurityEncryptionTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityProfile.java new file mode 100644 index 0000000000000..3fe44d39bf08c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityProfile.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the Security profile settings for the virtual machine or virtual machine scale set. */ +@Fluent +public final class SecurityProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecurityProfile.class); + + /* + * Specifies the security settings like secure boot and vTPM used while + * creating the virtual machine.

    Minimum api-version: 2020-12-01 + */ + @JsonProperty(value = "uefiSettings") + private UefiSettings uefiSettings; + + /* + * This property can be used by user in the request to enable or disable + * the Host Encryption for the virtual machine or virtual machine scale + * set. This will enable the encryption for all the disks including + * Resource/Temp disk at host itself.

    Default: The Encryption at + * host will be disabled unless this property is set to true for the + * resource. + */ + @JsonProperty(value = "encryptionAtHost") + private Boolean encryptionAtHost; + + /* + * Specifies the SecurityType of the virtual machine. It has to be set to + * any specified value to enable UefiSettings.

    Default: + * UefiSettings will not be enabled unless this property is set. + */ + @JsonProperty(value = "securityType") + private SecurityTypes securityType; + + /** + * Get the uefiSettings property: Specifies the security settings like secure boot and vTPM used while creating the + * virtual machine. <br><br>Minimum api-version: 2020-12-01. + * + * @return the uefiSettings value. + */ + public UefiSettings uefiSettings() { + return this.uefiSettings; + } + + /** + * Set the uefiSettings property: Specifies the security settings like secure boot and vTPM used while creating the + * virtual machine. <br><br>Minimum api-version: 2020-12-01. + * + * @param uefiSettings the uefiSettings value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withUefiSettings(UefiSettings uefiSettings) { + this.uefiSettings = uefiSettings; + return this; + } + + /** + * Get the encryptionAtHost property: This property can be used by user in the request to enable or disable the Host + * Encryption for the virtual machine or virtual machine scale set. This will enable the encryption for all the + * disks including Resource/Temp disk at host itself. <br><br> Default: The Encryption at host will be + * disabled unless this property is set to true for the resource. + * + * @return the encryptionAtHost value. + */ + public Boolean encryptionAtHost() { + return this.encryptionAtHost; + } + + /** + * Set the encryptionAtHost property: This property can be used by user in the request to enable or disable the Host + * Encryption for the virtual machine or virtual machine scale set. This will enable the encryption for all the + * disks including Resource/Temp disk at host itself. <br><br> Default: The Encryption at host will be + * disabled unless this property is set to true for the resource. + * + * @param encryptionAtHost the encryptionAtHost value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withEncryptionAtHost(Boolean encryptionAtHost) { + this.encryptionAtHost = encryptionAtHost; + return this; + } + + /** + * Get the securityType property: Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. <br><br> Default: UefiSettings will not be enabled unless + * this property is set. + * + * @return the securityType value. + */ + public SecurityTypes securityType() { + return this.securityType; + } + + /** + * Set the securityType property: Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. <br><br> Default: UefiSettings will not be enabled unless + * this property is set. + * + * @param securityType the securityType value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile 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(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityTypes.java new file mode 100644 index 0000000000000..e8d293c7fe8b9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SecurityTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityTypes. */ +public final class SecurityTypes extends ExpandableStringEnum { + /** Static value TrustedLaunch for SecurityTypes. */ + public static final SecurityTypes TRUSTED_LAUNCH = fromString("TrustedLaunch"); + + /** Static value ConfidentialVM for SecurityTypes. */ + public static final SecurityTypes CONFIDENTIAL_VM = fromString("ConfidentialVM"); + + /** + * Creates or finds a SecurityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityTypes. + */ + @JsonCreator + public static SecurityTypes fromString(String name) { + return fromString(name, SecurityTypes.class); + } + + /** @return known SecurityTypes values. */ + public static Collection values() { + return values(SecurityTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SelectPermissions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SelectPermissions.java new file mode 100644 index 0000000000000..89cae4c2d5cbf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SelectPermissions.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SelectPermissions. */ +public final class SelectPermissions extends ExpandableStringEnum { + /** Static value Permissions for SelectPermissions. */ + public static final SelectPermissions PERMISSIONS = fromString("Permissions"); + + /** + * Creates or finds a SelectPermissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding SelectPermissions. + */ + @JsonCreator + public static SelectPermissions fromString(String name) { + return fromString(name, SelectPermissions.class); + } + + /** @return known SelectPermissions values. */ + public static Collection values() { + return values(SelectPermissions.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SettingNames.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SettingNames.java new file mode 100644 index 0000000000000..596f085543969 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SettingNames.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SettingNames. */ +public enum SettingNames { + /** Enum value AutoLogon. */ + AUTO_LOGON("AutoLogon"), + + /** Enum value FirstLogonCommands. */ + FIRST_LOGON_COMMANDS("FirstLogonCommands"); + + /** The actual serialized value for a SettingNames instance. */ + private final String value; + + SettingNames(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SettingNames instance. + * + * @param value the serialized value to parse. + * @return the parsed SettingNames object, or null if unable to parse. + */ + @JsonCreator + public static SettingNames fromString(String value) { + SettingNames[] items = SettingNames.values(); + for (SettingNames item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ShareInfoElement.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ShareInfoElement.java new file mode 100644 index 0000000000000..12d00ce6e2a41 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ShareInfoElement.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ShareInfoElement model. */ +@Immutable +public final class ShareInfoElement { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ShareInfoElement.class); + + /* + * A relative URI containing the ID of the VM that has the disk attached. + */ + @JsonProperty(value = "vmUri", access = JsonProperty.Access.WRITE_ONLY) + private String vmUri; + + /** + * Get the vmUri property: A relative URI containing the ID of the VM that has the disk attached. + * + * @return the vmUri value. + */ + public String vmUri() { + return this.vmUri; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleries.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleries.java new file mode 100644 index 0000000000000..fd1127c2f8175 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleries.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 SharedGalleries. */ +public interface SharedGalleries { + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + PagedIterable list(String location); + + /** + * List shared galleries by subscription id or tenant id. + * + * @param location Resource location. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Galleries operation response. + */ + PagedIterable list(String location, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id. + */ + SharedGallery get(String location, String galleryUniqueName); + + /** + * Get a shared gallery by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery by subscription id or tenant id along with {@link Response}. + */ + Response getWithResponse(String location, String galleryUniqueName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGallery.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGallery.java new file mode 100644 index 0000000000000..353141bd2a243 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGallery.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner; + +/** An immutable client-side representation of SharedGallery. */ +public interface SharedGallery { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the uniqueId property: The unique id of this shared gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner object. + * + * @return the inner object. + */ + SharedGalleryInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImage.java new file mode 100644 index 0000000000000..9b7113688f55b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImage.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of SharedGalleryImage. */ +public interface SharedGalleryImage { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the uniqueId property: The unique id of this shared gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the osType property: This property allows you to specify the type of the OS that is included in the disk + * when creating a VM from a managed image. <br><br> Possible values are: <br><br> + * **Windows** <br><br> **Linux**. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the osState property: This property allows the user to specify whether the virtual machines created under + * this image are 'Generalized' or 'Specialized'. + * + * @return the osState value. + */ + OperatingSystemStateTypes osState(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery image definition. This property can be used + * for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + GalleryImageIdentifier identifier(); + + /** + * Gets the recommended property: The properties describe the recommended machine configuration for this Image + * Definition. These properties are updatable. + * + * @return the recommended value. + */ + RecommendedMachineConfiguration recommended(); + + /** + * Gets the disallowed property: Describes the disallowed disk types. + * + * @return the disallowed value. + */ + Disallowed disallowed(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the features property: A list of gallery image features. + * + * @return the features value. + */ + List features(); + + /** + * Gets the purchasePlan property: Describes the gallery image definition purchase plan. This is used by marketplace + * images. + * + * @return the purchasePlan value. + */ + ImagePurchasePlan purchasePlan(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner object. + * + * @return the inner object. + */ + SharedGalleryImageInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageList.java new file mode 100644 index 0000000000000..a08a6a3a13c82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Shared Gallery Images operation response. */ +@Fluent +public final class SharedGalleryImageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageList.class); + + /* + * A list of shared gallery images. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of shared gallery images. Call ListNext() + * with this to fetch the next page of shared gallery images. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of shared gallery images. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of shared gallery images. + * + * @param value the value value to set. + * @return the SharedGalleryImageList object itself. + */ + public SharedGalleryImageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of shared gallery images. Call ListNext() with this to + * fetch the next page of shared gallery images. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of shared gallery images. Call ListNext() with this to + * fetch the next page of shared gallery images. + * + * @param nextLink the nextLink value to set. + * @return the SharedGalleryImageList object itself. + */ + public SharedGalleryImageList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model SharedGalleryImageList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersion.java new file mode 100644 index 0000000000000..1fb5d86e6553f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersion.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SharedGalleryImageVersion. */ +public interface SharedGalleryImageVersion { + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the uniqueId property: The unique id of this shared gallery. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the publishedDate property: The published date of the gallery image version Definition. This property can be + * used for decommissioning purposes. This property is updatable. + * + * @return the publishedDate value. + */ + OffsetDateTime publishedDate(); + + /** + * Gets the endOfLifeDate property: The end of life date of the gallery image version Definition. This property can + * be used for decommissioning purposes. This property is updatable. + * + * @return the endOfLifeDate value. + */ + OffsetDateTime endOfLifeDate(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner object. + * + * @return the inner object. + */ + SharedGalleryImageVersionInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersionList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersionList.java new file mode 100644 index 0000000000000..ee9e83d320d66 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersionList.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryImageVersionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Shared Gallery Image versions operation response. */ +@Fluent +public final class SharedGalleryImageVersionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryImageVersionList.class); + + /* + * A list of shared gallery images versions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of shared gallery image versions. Call + * ListNext() with this to fetch the next page of shared gallery image + * versions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of shared gallery images versions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of shared gallery images versions. + * + * @param value the value value to set. + * @return the SharedGalleryImageVersionList object itself. + */ + public SharedGalleryImageVersionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of shared gallery image versions. Call ListNext() with + * this to fetch the next page of shared gallery image versions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of shared gallery image versions. Call ListNext() with + * this to fetch the next page of shared gallery image versions. + * + * @param nextLink the nextLink value to set. + * @return the SharedGalleryImageVersionList object itself. + */ + public SharedGalleryImageVersionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model SharedGalleryImageVersionList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersions.java new file mode 100644 index 0000000000000..ebe01f208d5f1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImageVersions.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 SharedGalleryImageVersions. */ +public interface SharedGalleryImageVersions { + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + PagedIterable list(String location, String galleryUniqueName, String galleryImageName); + + /** + * List shared gallery image versions by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Image versions operation response. + */ + PagedIterable list( + String location, String galleryUniqueName, String galleryImageName, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id. + */ + SharedGalleryImageVersion get( + String location, String galleryUniqueName, String galleryImageName, String galleryImageVersionName); + + /** + * Get a shared gallery image version by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param galleryImageVersionName The name of the gallery image version to be created. Needs to follow semantic + * version name pattern: The allowed characters are digit and period. Digits must be within the range of a + * 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image version by subscription id or tenant id along with {@link Response}. + */ + Response getWithResponse( + String location, + String galleryUniqueName, + String galleryImageName, + String galleryImageVersionName, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImages.java new file mode 100644 index 0000000000000..229a8374dbc36 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryImages.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 SharedGalleryImages. */ +public interface SharedGalleryImages { + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + PagedIterable list(String location, String galleryUniqueName); + + /** + * List shared gallery images by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param sharedTo The query parameter to decide what shared galleries to fetch when doing listing operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Shared Gallery Images operation response. + */ + PagedIterable list( + String location, String galleryUniqueName, SharedToValues sharedTo, Context context); + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id. + */ + SharedGalleryImage get(String location, String galleryUniqueName, String galleryImageName); + + /** + * Get a shared gallery image by subscription id or tenant id. + * + * @param location Resource location. + * @param galleryUniqueName The unique name of the Shared Gallery. + * @param galleryImageName The name of the Shared Gallery Image Definition from which the Image Versions are to be + * listed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a shared gallery image by subscription id or tenant id along with {@link Response}. + */ + Response getWithResponse( + String location, String galleryUniqueName, String galleryImageName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryList.java new file mode 100644 index 0000000000000..86dc5d6ac9d03 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedGalleryList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SharedGalleryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Shared Galleries operation response. */ +@Fluent +public final class SharedGalleryList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedGalleryList.class); + + /* + * A list of shared galleries. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of shared galleries. Call ListNext() with + * this to fetch the next page of shared galleries. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of shared galleries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of shared galleries. + * + * @param value the value value to set. + * @return the SharedGalleryList object itself. + */ + public SharedGalleryList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch + * the next page of shared galleries. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch + * the next page of shared galleries. + * + * @param nextLink the nextLink value to set. + * @return the SharedGalleryList object itself. + */ + public SharedGalleryList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model SharedGalleryList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedToValues.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedToValues.java new file mode 100644 index 0000000000000..391951917ddf1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharedToValues.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SharedToValues. */ +public final class SharedToValues extends ExpandableStringEnum { + /** Static value tenant for SharedToValues. */ + public static final SharedToValues TENANT = fromString("tenant"); + + /** + * Creates or finds a SharedToValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharedToValues. + */ + @JsonCreator + public static SharedToValues fromString(String name) { + return fromString(name, SharedToValues.class); + } + + /** @return known SharedToValues values. */ + public static Collection values() { + return values(SharedToValues.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfile.java new file mode 100644 index 0000000000000..b509c60ce26a7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfile.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Profile for gallery sharing to subscription or tenant. */ +@Fluent +public final class SharingProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharingProfile.class); + + /* + * This property allows you to specify the permission of sharing gallery. + *

    Possible values are:

    **Private**

    **Groups** + */ + @JsonProperty(value = "permissions") + private GallerySharingPermissionTypes permissions; + + /* + * A list of sharing profile groups. + */ + @JsonProperty(value = "groups", access = JsonProperty.Access.WRITE_ONLY) + private List groups; + + /** + * Get the permissions property: This property allows you to specify the permission of sharing gallery. + * <br><br> Possible values are: <br><br> **Private** <br><br> **Groups**. + * + * @return the permissions value. + */ + public GallerySharingPermissionTypes permissions() { + return this.permissions; + } + + /** + * Set the permissions property: This property allows you to specify the permission of sharing gallery. + * <br><br> Possible values are: <br><br> **Private** <br><br> **Groups**. + * + * @param permissions the permissions value to set. + * @return the SharingProfile object itself. + */ + public SharingProfile withPermissions(GallerySharingPermissionTypes permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the groups property: A list of sharing profile groups. + * + * @return the groups value. + */ + public List groups() { + return this.groups; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groups() != null) { + groups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroup.java new file mode 100644 index 0000000000000..c54cff599048b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroup.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Group of the gallery sharing profile. */ +@Fluent +public final class SharingProfileGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharingProfileGroup.class); + + /* + * This property allows you to specify the type of sharing group.

    + * Possible values are:

    **Subscriptions**

    **AADTenants** + */ + @JsonProperty(value = "type") + private SharingProfileGroupTypes type; + + /* + * A list of subscription/tenant ids the gallery is aimed to be shared to. + */ + @JsonProperty(value = "ids") + private List ids; + + /** + * Get the type property: This property allows you to specify the type of sharing group. <br><br> + * Possible values are: <br><br> **Subscriptions** <br><br> **AADTenants**. + * + * @return the type value. + */ + public SharingProfileGroupTypes type() { + return this.type; + } + + /** + * Set the type property: This property allows you to specify the type of sharing group. <br><br> + * Possible values are: <br><br> **Subscriptions** <br><br> **AADTenants**. + * + * @param type the type value to set. + * @return the SharingProfileGroup object itself. + */ + public SharingProfileGroup withType(SharingProfileGroupTypes type) { + this.type = type; + return this; + } + + /** + * Get the ids property: A list of subscription/tenant ids the gallery is aimed to be shared to. + * + * @return the ids value. + */ + public List ids() { + return this.ids; + } + + /** + * Set the ids property: A list of subscription/tenant ids the gallery is aimed to be shared to. + * + * @param ids the ids value to set. + * @return the SharingProfileGroup object itself. + */ + public SharingProfileGroup withIds(List ids) { + this.ids = ids; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroupTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroupTypes.java new file mode 100644 index 0000000000000..687134aed5260 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingProfileGroupTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SharingProfileGroupTypes. */ +public final class SharingProfileGroupTypes extends ExpandableStringEnum { + /** Static value Subscriptions for SharingProfileGroupTypes. */ + public static final SharingProfileGroupTypes SUBSCRIPTIONS = fromString("Subscriptions"); + + /** Static value AADTenants for SharingProfileGroupTypes. */ + public static final SharingProfileGroupTypes AADTENANTS = fromString("AADTenants"); + + /** + * Creates or finds a SharingProfileGroupTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharingProfileGroupTypes. + */ + @JsonCreator + public static SharingProfileGroupTypes fromString(String name) { + return fromString(name, SharingProfileGroupTypes.class); + } + + /** @return known SharingProfileGroupTypes values. */ + public static Collection values() { + return values(SharingProfileGroupTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdate.java new file mode 100644 index 0000000000000..aa7adacfa2682 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdate.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import java.util.List; + +/** An immutable client-side representation of SharingUpdate. */ +public interface SharingUpdate { + /** + * Gets the operationType property: This property allows you to specify the operation type of gallery sharing + * update. <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** + * <br><br> **Reset**. + * + * @return the operationType value. + */ + SharingUpdateOperationTypes operationType(); + + /** + * Gets the groups property: A list of sharing profile groups. + * + * @return the groups value. + */ + List groups(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner object. + * + * @return the inner object. + */ + SharingUpdateInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdateOperationTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdateOperationTypes.java new file mode 100644 index 0000000000000..3340e206f19c2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SharingUpdateOperationTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SharingUpdateOperationTypes. */ +public final class SharingUpdateOperationTypes extends ExpandableStringEnum { + /** Static value Add for SharingUpdateOperationTypes. */ + public static final SharingUpdateOperationTypes ADD = fromString("Add"); + + /** Static value Remove for SharingUpdateOperationTypes. */ + public static final SharingUpdateOperationTypes REMOVE = fromString("Remove"); + + /** Static value Reset for SharingUpdateOperationTypes. */ + public static final SharingUpdateOperationTypes RESET = fromString("Reset"); + + /** + * Creates or finds a SharingUpdateOperationTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharingUpdateOperationTypes. + */ + @JsonCreator + public static SharingUpdateOperationTypes fromString(String name) { + return fromString(name, SharingUpdateOperationTypes.class); + } + + /** @return known SharingUpdateOperationTypes values. */ + public static Collection values() { + return values(SharingUpdateOperationTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Sku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Sku.java new file mode 100644 index 0000000000000..71ef7676010ce --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Sku.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is + * currently on, you need to deallocate the VMs in the scale set before you modify the SKU name. + */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The sku name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the tier of virtual machines in a scale set.

    + * Possible Values:

    **Standard**

    **Basic** + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Specifies the number of virtual machines in the scale set. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name property: The sku name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The sku name. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible + * Values:<br /><br /> **Standard**<br /><br /> **Basic**. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Specifies the tier of virtual machines in a scale set.<br /><br /> Possible + * Values:<br /><br /> **Standard**<br /><br /> **Basic**. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity property: Specifies the number of virtual machines in the scale set. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Specifies the number of virtual machines in the scale set. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshot.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshot.java new file mode 100644 index 0000000000000..1f290acdaa22f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshot.java @@ -0,0 +1,753 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Snapshot. */ +public interface Snapshot { + /** + * 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 managedBy property: Unused. Always Null. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an + * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * + * @return the sku value. + */ + SnapshotSku sku(); + + /** + * Gets the extendedLocation property: The extended location where the snapshot will be created. Extended location + * cannot be changed. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the timeCreated property: The time when the snapshot was created. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the osType property: The Operating System type. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to OS disks + * only. + * + * @return the hyperVGeneration value. + */ + HyperVGeneration hyperVGeneration(); + + /** + * Gets the purchasePlan property: Purchase plan information for the image from which the source disk for the + * snapshot was originally created. + * + * @return the purchasePlan value. + */ + PurchasePlanAutoGenerated purchasePlan(); + + /** + * Gets the supportedCapabilities property: List of supported capabilities (like Accelerated Networking) for the + * image from which the source disk from the snapshot was originally created. + * + * @return the supportedCapabilities value. + */ + SupportedCapabilities supportedCapabilities(); + + /** + * Gets the creationData property: Disk source information. CreationData information cannot be changed after the + * disk has been created. + * + * @return the creationData value. + */ + CreationData creationData(); + + /** + * Gets the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + Integer diskSizeGB(); + + /** + * Gets the diskSizeBytes property: The size of the disk in bytes. This field is read only. + * + * @return the diskSizeBytes value. + */ + Long diskSizeBytes(); + + /** + * Gets the diskState property: The state of the snapshot. + * + * @return the diskState value. + */ + DiskState diskState(); + + /** + * Gets the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + EncryptionSettingsCollection encryptionSettingsCollection(); + + /** + * Gets the provisioningState property: The disk provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same disk occupy + * less space than full snapshots and can be diffed. + * + * @return the incremental value. + */ + Boolean incremental(); + + /** + * Gets the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + Encryption encryption(); + + /** + * Gets the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + NetworkAccessPolicy networkAccessPolicy(); + + /** + * Gets the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + String diskAccessId(); + + /** + * Gets the securityProfile property: Contains the security related information for the resource. + * + * @return the securityProfile value. + */ + DiskSecurityProfile securityProfile(); + + /** + * Gets the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @return the supportsHibernation value. + */ + Boolean supportsHibernation(); + + /** + * Gets the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the completionPercent property: Percentage complete for the background copy when a resource is created via + * the CopyStart operation. + * + * @return the completionPercent value. + */ + Float completionPercent(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner object. + * + * @return the inner object. + */ + SnapshotInner innerModel(); + + /** The entirety of the Snapshot definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Snapshot definition stages. */ + interface DefinitionStages { + /** The first stage of the Snapshot definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Snapshot 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 Snapshot definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Snapshot 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.WithSku, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithOsType, + DefinitionStages.WithHyperVGeneration, + DefinitionStages.WithPurchasePlan, + DefinitionStages.WithSupportedCapabilities, + DefinitionStages.WithCreationData, + DefinitionStages.WithDiskSizeGB, + DefinitionStages.WithEncryptionSettingsCollection, + DefinitionStages.WithIncremental, + DefinitionStages.WithEncryption, + DefinitionStages.WithNetworkAccessPolicy, + DefinitionStages.WithDiskAccessId, + DefinitionStages.WithSecurityProfile, + DefinitionStages.WithSupportsHibernation, + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithCompletionPercent { + /** + * Executes the create request. + * + * @return the created resource. + */ + Snapshot create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Snapshot create(Context context); + } + /** The stage of the Snapshot 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 Snapshot definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + * This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to + * the same sku as the previous snapshot. + * + * @param sku The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional + * parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * @return the next definition stage. + */ + WithCreate withSku(SnapshotSku sku); + } + /** The stage of the Snapshot definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location where the snapshot will be created. + * Extended location cannot be changed.. + * + * @param extendedLocation The extended location where the snapshot will be created. Extended location + * cannot be changed. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the Snapshot definition allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: The Operating System type.. + * + * @param osType The Operating System type. + * @return the next definition stage. + */ + WithCreate withOsType(OperatingSystemTypes osType); + } + /** The stage of the Snapshot definition allowing to specify hyperVGeneration. */ + interface WithHyperVGeneration { + /** + * Specifies the hyperVGeneration property: The hypervisor generation of the Virtual Machine. Applicable to + * OS disks only.. + * + * @param hyperVGeneration The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + * @return the next definition stage. + */ + WithCreate withHyperVGeneration(HyperVGeneration hyperVGeneration); + } + /** The stage of the Snapshot definition allowing to specify purchasePlan. */ + interface WithPurchasePlan { + /** + * Specifies the purchasePlan property: Purchase plan information for the image from which the source disk + * for the snapshot was originally created.. + * + * @param purchasePlan Purchase plan information for the image from which the source disk for the snapshot + * was originally created. + * @return the next definition stage. + */ + WithCreate withPurchasePlan(PurchasePlanAutoGenerated purchasePlan); + } + /** The stage of the Snapshot definition allowing to specify supportedCapabilities. */ + interface WithSupportedCapabilities { + /** + * Specifies the supportedCapabilities property: List of supported capabilities (like Accelerated + * Networking) for the image from which the source disk from the snapshot was originally created.. + * + * @param supportedCapabilities List of supported capabilities (like Accelerated Networking) for the image + * from which the source disk from the snapshot was originally created. + * @return the next definition stage. + */ + WithCreate withSupportedCapabilities(SupportedCapabilities supportedCapabilities); + } + /** The stage of the Snapshot definition allowing to specify creationData. */ + interface WithCreationData { + /** + * Specifies the creationData property: Disk source information. CreationData information cannot be changed + * after the disk has been created.. + * + * @param creationData Disk source information. CreationData information cannot be changed after the disk + * has been created. + * @return the next definition stage. + */ + WithCreate withCreationData(CreationData creationData); + } + /** The stage of the Snapshot definition allowing to specify diskSizeGB. */ + interface WithDiskSizeGB { + /** + * Specifies the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for updates or creation with other + * options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + * can only increase the disk's size.. + * + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it + * indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + * @return the next definition stage. + */ + WithCreate withDiskSizeGB(Integer diskSizeGB); + } + /** The stage of the Snapshot definition allowing to specify encryptionSettingsCollection. */ + interface WithEncryptionSettingsCollection { + /** + * Specifies the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk + * Encryption, can contain multiple encryption settings per disk or snapshot.. + * + * @param encryptionSettingsCollection Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * @return the next definition stage. + */ + WithCreate withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection); + } + /** The stage of the Snapshot definition allowing to specify incremental. */ + interface WithIncremental { + /** + * Specifies the incremental property: Whether a snapshot is incremental. Incremental snapshots on the same + * disk occupy less space than full snapshots and can be diffed.. + * + * @param incremental Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less + * space than full snapshots and can be diffed. + * @return the next definition stage. + */ + WithCreate withIncremental(Boolean incremental); + } + /** The stage of the Snapshot definition allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys.. + * + * @param encryption Encryption property can be used to encrypt data at rest with customer managed keys or + * platform managed keys. + * @return the next definition stage. + */ + WithCreate withEncryption(Encryption encryption); + } + /** The stage of the Snapshot definition allowing to specify networkAccessPolicy. */ + interface WithNetworkAccessPolicy { + /** + * Specifies the networkAccessPolicy property: Policy for accessing the disk via network.. + * + * @param networkAccessPolicy Policy for accessing the disk via network. + * @return the next definition stage. + */ + WithCreate withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy); + } + /** The stage of the Snapshot definition allowing to specify diskAccessId. */ + interface WithDiskAccessId { + /** + * Specifies the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on + * disks.. + * + * @param diskAccessId ARM id of the DiskAccess resource for using private endpoints on disks. + * @return the next definition stage. + */ + WithCreate withDiskAccessId(String diskAccessId); + } + /** The stage of the Snapshot definition allowing to specify securityProfile. */ + interface WithSecurityProfile { + /** + * Specifies the securityProfile property: Contains the security related information for the resource.. + * + * @param securityProfile Contains the security related information for the resource. + * @return the next definition stage. + */ + WithCreate withSecurityProfile(DiskSecurityProfile securityProfile); + } + /** The stage of the Snapshot definition allowing to specify supportsHibernation. */ + interface WithSupportsHibernation { + /** + * Specifies the supportsHibernation property: Indicates the OS on a snapshot supports hibernation.. + * + * @param supportsHibernation Indicates the OS on a snapshot supports hibernation. + * @return the next definition stage. + */ + WithCreate withSupportsHibernation(Boolean supportsHibernation); + } + /** The stage of the Snapshot definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Policy for controlling export on the disk.. + * + * @param publicNetworkAccess Policy for controlling export on the disk. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the Snapshot definition allowing to specify completionPercent. */ + interface WithCompletionPercent { + /** + * Specifies the completionPercent property: Percentage complete for the background copy when a resource is + * created via the CopyStart operation.. + * + * @param completionPercent Percentage complete for the background copy when a resource is created via the + * CopyStart operation. + * @return the next definition stage. + */ + WithCreate withCompletionPercent(Float completionPercent); + } + } + /** + * Begins update for the Snapshot resource. + * + * @return the stage of resource update. + */ + Snapshot.Update update(); + + /** The template for Snapshot update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithOsType, + UpdateStages.WithDiskSizeGB, + UpdateStages.WithEncryptionSettingsCollection, + UpdateStages.WithEncryption, + UpdateStages.WithNetworkAccessPolicy, + UpdateStages.WithDiskAccessId, + UpdateStages.WithSupportsHibernation, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithSupportedCapabilities { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Snapshot apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Snapshot apply(Context context); + } + /** The Snapshot update stages. */ + interface UpdateStages { + /** The stage of the Snapshot 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 Snapshot update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + * This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to + * the same sku as the previous snapshot. + * + * @param sku The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional + * parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * @return the next definition stage. + */ + Update withSku(SnapshotSku sku); + } + /** The stage of the Snapshot update allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: the Operating System type.. + * + * @param osType the Operating System type. + * @return the next definition stage. + */ + Update withOsType(OperatingSystemTypes osType); + } + /** The stage of the Snapshot update allowing to specify diskSizeGB. */ + interface WithDiskSizeGB { + /** + * Specifies the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it + * indicates the size of the disk to create. If this field is present for updates or creation with other + * options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and + * can only increase the disk's size.. + * + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it + * indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can + * only increase the disk's size. + * @return the next definition stage. + */ + Update withDiskSizeGB(Integer diskSizeGB); + } + /** The stage of the Snapshot update allowing to specify encryptionSettingsCollection. */ + interface WithEncryptionSettingsCollection { + /** + * Specifies the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk + * Encryption, can contain multiple encryption settings per disk or snapshot.. + * + * @param encryptionSettingsCollection Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * @return the next definition stage. + */ + Update withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection); + } + /** The stage of the Snapshot update allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Encryption property can be used to encrypt data at rest with customer + * managed keys or platform managed keys.. + * + * @param encryption Encryption property can be used to encrypt data at rest with customer managed keys or + * platform managed keys. + * @return the next definition stage. + */ + Update withEncryption(Encryption encryption); + } + /** The stage of the Snapshot update allowing to specify networkAccessPolicy. */ + interface WithNetworkAccessPolicy { + /** + * Specifies the networkAccessPolicy property: Policy for accessing the disk via network.. + * + * @param networkAccessPolicy Policy for accessing the disk via network. + * @return the next definition stage. + */ + Update withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy); + } + /** The stage of the Snapshot update allowing to specify diskAccessId. */ + interface WithDiskAccessId { + /** + * Specifies the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on + * disks.. + * + * @param diskAccessId ARM id of the DiskAccess resource for using private endpoints on disks. + * @return the next definition stage. + */ + Update withDiskAccessId(String diskAccessId); + } + /** The stage of the Snapshot update allowing to specify supportsHibernation. */ + interface WithSupportsHibernation { + /** + * Specifies the supportsHibernation property: Indicates the OS on a snapshot supports hibernation.. + * + * @param supportsHibernation Indicates the OS on a snapshot supports hibernation. + * @return the next definition stage. + */ + Update withSupportsHibernation(Boolean supportsHibernation); + } + /** The stage of the Snapshot update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Policy for controlling export on the disk.. + * + * @param publicNetworkAccess Policy for controlling export on the disk. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the Snapshot update allowing to specify supportedCapabilities. */ + interface WithSupportedCapabilities { + /** + * Specifies the supportedCapabilities property: List of supported capabilities (like accelerated + * networking) for the image from which the OS disk was created.. + * + * @param supportedCapabilities List of supported capabilities (like accelerated networking) for the image + * from which the OS disk was created. + * @return the next definition stage. + */ + Update withSupportedCapabilities(SupportedCapabilities supportedCapabilities); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Snapshot refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Snapshot refresh(Context context); + + /** + * Grants access to a snapshot. + * + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(GrantAccessData grantAccessData); + + /** + * Grants access to a snapshot. + * + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a snapshot. + * + * @throws com.azure.core.management.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 revokeAccess(); + + /** + * Revokes access to a snapshot. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotList.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotList.java new file mode 100644 index 0000000000000..2ae652e8e6dee --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotList.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Snapshots operation response. */ +@Fluent +public final class SnapshotList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotList.class); + + /* + * A list of snapshots. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of snapshots. Call ListNext() with this + * to fetch the next page of snapshots. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of snapshots. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of snapshots. + * + * @param value the value value to set. + * @return the SnapshotList object itself. + */ + public SnapshotList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the + * next page of snapshots. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the + * next page of snapshots. + * + * @param nextLink the nextLink value to set. + * @return the SnapshotList object itself. + */ + public SnapshotList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model SnapshotList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotSku.java new file mode 100644 index 0000000000000..2f2d0e9fcc2c2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotSku.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for + * incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. + */ +@Fluent +public final class SnapshotSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotSku.class); + + /* + * The sku name. + */ + @JsonProperty(value = "name") + private SnapshotStorageAccountTypes name; + + /* + * The sku tier. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /** + * Get the name property: The sku name. + * + * @return the name value. + */ + public SnapshotStorageAccountTypes name() { + return this.name; + } + + /** + * Set the name property: The sku name. + * + * @param name the name value to set. + * @return the SnapshotSku object itself. + */ + public SnapshotSku withName(SnapshotStorageAccountTypes name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotStorageAccountTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotStorageAccountTypes.java new file mode 100644 index 0000000000000..93d3d0633c33b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotStorageAccountTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SnapshotStorageAccountTypes. */ +public final class SnapshotStorageAccountTypes extends ExpandableStringEnum { + /** Static value Standard_LRS for SnapshotStorageAccountTypes. */ + public static final SnapshotStorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); + + /** Static value Premium_LRS for SnapshotStorageAccountTypes. */ + public static final SnapshotStorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); + + /** Static value Standard_ZRS for SnapshotStorageAccountTypes. */ + public static final SnapshotStorageAccountTypes STANDARD_ZRS = fromString("Standard_ZRS"); + + /** + * Creates or finds a SnapshotStorageAccountTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SnapshotStorageAccountTypes. + */ + @JsonCreator + public static SnapshotStorageAccountTypes fromString(String name) { + return fromString(name, SnapshotStorageAccountTypes.class); + } + + /** @return known SnapshotStorageAccountTypes values. */ + public static Collection values() { + return values(SnapshotStorageAccountTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotUpdate.java new file mode 100644 index 0000000000000..66c1e0c425370 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SnapshotUpdate.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SnapshotUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Snapshot update resource. */ +@Fluent +public final class SnapshotUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SnapshotUpdate.class); + + /* + * Snapshot resource update properties. + */ + @JsonProperty(value = "properties") + private SnapshotUpdateProperties innerProperties; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The snapshots sku name. Can be Standard_LRS, Premium_LRS, or + * Standard_ZRS. This is an optional parameter for incremental snapshot and + * the default behavior is the SKU will be set to the same sku as the + * previous snapshot + */ + @JsonProperty(value = "sku") + private SnapshotSku sku; + + /** + * Get the innerProperties property: Snapshot resource update properties. + * + * @return the innerProperties value. + */ + private SnapshotUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 SnapshotUpdate object itself. + */ + public SnapshotUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an + * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * + * @return the sku value. + */ + public SnapshotSku sku() { + return this.sku; + } + + /** + * Set the sku property: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an + * optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as + * the previous snapshot. + * + * @param sku the sku value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withSku(SnapshotSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the osType property: the Operating System type. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: the Operating System type. + * + * @param osType the osType value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withOsType(OperatingSystemTypes osType) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.innerProperties() == null ? null : this.innerProperties().diskSizeGB(); + } + + /** + * Set the diskSizeGB property: If creationData.createOption is Empty, this field is mandatory and it indicates the + * size of the disk to create. If this field is present for updates or creation with other options, it indicates a + * resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's + * size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withDiskSizeGB(Integer diskSizeGB) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withDiskSizeGB(diskSizeGB); + return this; + } + + /** + * Get the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @return the encryptionSettingsCollection value. + */ + public EncryptionSettingsCollection encryptionSettingsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionSettingsCollection(); + } + + /** + * Set the encryptionSettingsCollection property: Encryption settings collection used be Azure Disk Encryption, can + * contain multiple encryption settings per disk or snapshot. + * + * @param encryptionSettingsCollection the encryptionSettingsCollection value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withEncryptionSettingsCollection(EncryptionSettingsCollection encryptionSettingsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withEncryptionSettingsCollection(encryptionSettingsCollection); + return this; + } + + /** + * Get the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: Encryption property can be used to encrypt data at rest with customer managed keys + * or platform managed keys. + * + * @param encryption the encryption value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withEncryption(Encryption encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Get the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @return the networkAccessPolicy value. + */ + public NetworkAccessPolicy networkAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().networkAccessPolicy(); + } + + /** + * Set the networkAccessPolicy property: Policy for accessing the disk via network. + * + * @param networkAccessPolicy the networkAccessPolicy value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withNetworkAccessPolicy(NetworkAccessPolicy networkAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withNetworkAccessPolicy(networkAccessPolicy); + return this; + } + + /** + * Get the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @return the diskAccessId value. + */ + public String diskAccessId() { + return this.innerProperties() == null ? null : this.innerProperties().diskAccessId(); + } + + /** + * Set the diskAccessId property: ARM id of the DiskAccess resource for using private endpoints on disks. + * + * @param diskAccessId the diskAccessId value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withDiskAccessId(String diskAccessId) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withDiskAccessId(diskAccessId); + return this; + } + + /** + * Get the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @return the supportsHibernation value. + */ + public Boolean supportsHibernation() { + return this.innerProperties() == null ? null : this.innerProperties().supportsHibernation(); + } + + /** + * Set the supportsHibernation property: Indicates the OS on a snapshot supports hibernation. + * + * @param supportsHibernation the supportsHibernation value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withSupportsHibernation(Boolean supportsHibernation) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withSupportsHibernation(supportsHibernation); + return this; + } + + /** + * Get the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Policy for controlling export on the disk. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @return the supportedCapabilities value. + */ + public SupportedCapabilities supportedCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().supportedCapabilities(); + } + + /** + * Set the supportedCapabilities property: List of supported capabilities (like accelerated networking) for the + * image from which the OS disk was created. + * + * @param supportedCapabilities the supportedCapabilities value to set. + * @return the SnapshotUpdate object itself. + */ + public SnapshotUpdate withSupportedCapabilities(SupportedCapabilities supportedCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new SnapshotUpdateProperties(); + } + this.innerProperties().withSupportedCapabilities(supportedCapabilities); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshots.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshots.java new file mode 100644 index 0000000000000..882fe35dccf49 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Snapshots.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 Snapshots. */ +public interface Snapshots { + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot. + */ + Snapshot getByResourceGroup(String resourceGroupName, String snapshotName); + + /** + * Gets information about a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a snapshot along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String snapshotName, Context context); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 snapshotName); + + /** + * Deletes a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 snapshotName, Context context); + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists snapshots under a resource group. + * + * @param resourceGroupName The name of the resource 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 List Snapshots operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + PagedIterable list(); + + /** + * Lists snapshots under 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 the List Snapshots operation response. + */ + PagedIterable list(Context context); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData); + + /** + * Grants access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param grantAccessData Access data object supplied in the body of the get snapshot access operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a disk access SAS uri. + */ + AccessUri grantAccess( + String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, Context context); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String snapshotName); + + /** + * Revokes access to a snapshot. + * + * @param resourceGroupName The name of the resource group. + * @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot + * is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 + * characters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revokeAccess(String resourceGroupName, String snapshotName, Context context); + + /** + * Gets information about a snapshot. + * + * @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 information about a snapshot along with {@link Response}. + */ + Snapshot getById(String id); + + /** + * Gets information about a snapshot. + * + * @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 information about a snapshot along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a snapshot. + * + * @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 a snapshot. + * + * @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 Snapshot resource. + * + * @param name resource name. + * @return the first stage of the new Snapshot definition. + */ + Snapshot.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SoftDeletePolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SoftDeletePolicy.java new file mode 100644 index 0000000000000..7a93e2f48c388 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SoftDeletePolicy.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains information about the soft deletion policy of the gallery. */ +@Fluent +public final class SoftDeletePolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SoftDeletePolicy.class); + + /* + * Enables soft-deletion for resources in this gallery, allowing them to be + * recovered within retention time. + */ + @JsonProperty(value = "isSoftDeleteEnabled") + private Boolean isSoftDeleteEnabled; + + /** + * Get the isSoftDeleteEnabled property: Enables soft-deletion for resources in this gallery, allowing them to be + * recovered within retention time. + * + * @return the isSoftDeleteEnabled value. + */ + public Boolean isSoftDeleteEnabled() { + return this.isSoftDeleteEnabled; + } + + /** + * Set the isSoftDeleteEnabled property: Enables soft-deletion for resources in this gallery, allowing them to be + * recovered within retention time. + * + * @param isSoftDeleteEnabled the isSoftDeleteEnabled value to set. + * @return the SoftDeletePolicy object itself. + */ + public SoftDeletePolicy withIsSoftDeleteEnabled(Boolean isSoftDeleteEnabled) { + this.isSoftDeleteEnabled = isSoftDeleteEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SourceVault.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SourceVault.java new file mode 100644 index 0000000000000..154292108a468 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SourceVault.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The vault id is an Azure Resource Manager Resource id in the form + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. + */ +@Fluent +public final class SourceVault { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceVault.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the SourceVault object itself. + */ + public SourceVault withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SpotRestorePolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SpotRestorePolicy.java new file mode 100644 index 0000000000000..73f01fef70313 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SpotRestorePolicy.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the Spot-Try-Restore properties for the virtual machine scale set. <br><br> With this property + * customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on + * capacity availability and pricing constraint. + */ +@Fluent +public final class SpotRestorePolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SpotRestorePolicy.class); + + /* + * Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances + * will be tried to be restored opportunistically based on capacity + * availability and pricing constraints + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * Timeout value expressed as an ISO 8601 time duration after which the + * platform will not try to restore the VMSS SPOT instances + */ + @JsonProperty(value = "restoreTimeout") + private String restoreTimeout; + + /** + * Get the enabled property: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to + * be restored opportunistically based on capacity availability and pricing constraints. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to + * be restored opportunistically based on capacity availability and pricing constraints. + * + * @param enabled the enabled value to set. + * @return the SpotRestorePolicy object itself. + */ + public SpotRestorePolicy withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the restoreTimeout property: Timeout value expressed as an ISO 8601 time duration after which the platform + * will not try to restore the VMSS SPOT instances. + * + * @return the restoreTimeout value. + */ + public String restoreTimeout() { + return this.restoreTimeout; + } + + /** + * Set the restoreTimeout property: Timeout value expressed as an ISO 8601 time duration after which the platform + * will not try to restore the VMSS SPOT instances. + * + * @param restoreTimeout the restoreTimeout value to set. + * @return the SpotRestorePolicy object itself. + */ + public SpotRestorePolicy withRestoreTimeout(String restoreTimeout) { + this.restoreTimeout = restoreTimeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshConfiguration.java new file mode 100644 index 0000000000000..f07bfa55dad6a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshConfiguration.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SSH configuration for Linux based VMs running on Azure. */ +@Fluent +public final class SshConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshConfiguration.class); + + /* + * The list of SSH public keys used to authenticate with linux based VMs. + */ + @JsonProperty(value = "publicKeys") + private List publicKeys; + + /** + * 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()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKey.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKey.java new file mode 100644 index 0000000000000..4c697e1f66170 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKey.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * 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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKey.class); + + /* + * 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 + */ + @JsonProperty(value = "path") + 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://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + */ + @JsonProperty(value = "keyData") + private String keyData; + + /** + * 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://docs.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://docs.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() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyGenerateKeyPairResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyGenerateKeyPairResult.java new file mode 100644 index 0000000000000..b766d42705b4b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyGenerateKeyPairResult.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner; + +/** An immutable client-side representation of SshPublicKeyGenerateKeyPairResult. */ +public interface SshPublicKeyGenerateKeyPairResult { + /** + * Gets the privateKey property: Private key portion of the key pair used to authenticate to a virtual machine + * through ssh. The private key is returned in RFC3447 format and should be treated as a secret. + * + * @return the privateKey value. + */ + String privateKey(); + + /** + * Gets the publicKey property: Public key portion of the key pair used to authenticate to a virtual machine through + * ssh. The public key is in ssh-rsa format. + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * Gets the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyGenerateKeyPairResultInner + * object. + * + * @return the inner object. + */ + SshPublicKeyGenerateKeyPairResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyResource.java new file mode 100644 index 0000000000000..e7cc4265ac5b4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyResource.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import java.util.Map; + +/** An immutable client-side representation of SshPublicKeyResource. */ +public interface SshPublicKeyResource { + /** + * 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 publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner object. + * + * @return the inner object. + */ + SshPublicKeyResourceInner innerModel(); + + /** The entirety of the SshPublicKeyResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The SshPublicKeyResource definition stages. */ + interface DefinitionStages { + /** The first stage of the SshPublicKeyResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SshPublicKeyResource 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 SshPublicKeyResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the SshPublicKeyResource 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.WithPublicKey { + /** + * Executes the create request. + * + * @return the created resource. + */ + SshPublicKeyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SshPublicKeyResource create(Context context); + } + /** The stage of the SshPublicKeyResource 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 SshPublicKeyResource definition allowing to specify publicKey. */ + interface WithPublicKey { + /** + * Specifies the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. + * If this property is not initially provided when the resource is created, the publicKey property will be + * populated when generateKeyPair is called. If the public key is provided upon resource creation, the + * provided public key needs to be at least 2048-bit and in ssh-rsa format.. + * + * @param publicKey SSH public key used to authenticate to a virtual machine through ssh. If this property + * is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public + * key needs to be at least 2048-bit and in ssh-rsa format. + * @return the next definition stage. + */ + WithCreate withPublicKey(String publicKey); + } + } + /** + * Begins update for the SshPublicKeyResource resource. + * + * @return the stage of resource update. + */ + SshPublicKeyResource.Update update(); + + /** The template for SshPublicKeyResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithPublicKey { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SshPublicKeyResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SshPublicKeyResource apply(Context context); + } + /** The SshPublicKeyResource update stages. */ + interface UpdateStages { + /** The stage of the SshPublicKeyResource 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 SshPublicKeyResource update allowing to specify publicKey. */ + interface WithPublicKey { + /** + * Specifies the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. + * If this property is not initially provided when the resource is created, the publicKey property will be + * populated when generateKeyPair is called. If the public key is provided upon resource creation, the + * provided public key needs to be at least 2048-bit and in ssh-rsa format.. + * + * @param publicKey SSH public key used to authenticate to a virtual machine through ssh. If this property + * is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public + * key needs to be at least 2048-bit and in ssh-rsa format. + * @return the next definition stage. + */ + Update withPublicKey(String publicKey); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SshPublicKeyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SshPublicKeyResource refresh(Context context); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair. + */ + SshPublicKeyGenerateKeyPairResult generateKeyPair(); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response}. + */ + Response generateKeyPairWithResponse(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyUpdateResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyUpdateResource.java new file mode 100644 index 0000000000000..87c9291ab634e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeyUpdateResource.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Specifies information about the SSH public key. */ +@Fluent +public final class SshPublicKeyUpdateResource extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeyUpdateResource.class); + + /* + * Properties of the SSH public key. + */ + @JsonProperty(value = "properties") + private SshPublicKeyResourceProperties innerProperties; + + /** + * Get the innerProperties property: Properties of the SSH public key. + * + * @return the innerProperties value. + */ + private SshPublicKeyResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SshPublicKeyUpdateResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.innerProperties() == null ? null : this.innerProperties().publicKey(); + } + + /** + * Set the publicKey property: SSH public key used to authenticate to a virtual machine through ssh. If this + * property is not initially provided when the resource is created, the publicKey property will be populated when + * generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to + * be at least 2048-bit and in ssh-rsa format. + * + * @param publicKey the publicKey value to set. + * @return the SshPublicKeyUpdateResource object itself. + */ + public SshPublicKeyUpdateResource withPublicKey(String publicKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SshPublicKeyResourceProperties(); + } + this.innerProperties().withPublicKey(publicKey); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeys.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeys.java new file mode 100644 index 0000000000000..75f3d193d58fc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeys.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 SshPublicKeys. */ +public interface SshPublicKeys { + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + PagedIterable list(); + + /** + * Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next + * page of SSH public keys. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + PagedIterable list(Context context); + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to + * get the next page of SSH public keys. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list SSH public keys operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 sshPublicKeyName); + + /** + * Delete an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteWithResponse(String resourceGroupName, String sshPublicKeyName, Context context); + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key. + */ + SshPublicKeyResource getByResourceGroup(String resourceGroupName, String sshPublicKeyName); + + /** + * Retrieves information about an SSH public key. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair. + */ + SshPublicKeyGenerateKeyPairResult generateKeyPair(String resourceGroupName, String sshPublicKeyName); + + /** + * Generates and returns a public/private key pair and populates the SSH public key resource with the public key. + * The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource. + * + * @param resourceGroupName The name of the resource group. + * @param sshPublicKeyName The name of the SSH public key. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response from generation of an SSH key pair along with {@link Response}. + */ + Response generateKeyPairWithResponse( + String resourceGroupName, String sshPublicKeyName, Context context); + + /** + * Retrieves information about an SSH public key. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + SshPublicKeyResource getById(String id); + + /** + * Retrieves information about an SSH public key. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specifies information about the SSH public key along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an SSH public key. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an SSH public key. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SshPublicKeyResource resource. + * + * @param name resource name. + * @return the first stage of the new SshPublicKeyResource definition. + */ + SshPublicKeyResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeysGroupListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeysGroupListResult.java new file mode 100644 index 0000000000000..e5a939c1d7988 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SshPublicKeysGroupListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.SshPublicKeyResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list SSH public keys operation response. */ +@Fluent +public final class SshPublicKeysGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SshPublicKeysGroupListResult.class); + + /* + * The list of SSH public keys + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of SSH public keys. Call ListNext() with + * this URI to fetch the next page of SSH public keys. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of SSH public keys. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of SSH public keys. + * + * @param value the value value to set. + * @return the SshPublicKeysGroupListResult object itself. + */ + public SshPublicKeysGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of SSH public keys. Call ListNext() with this URI to + * fetch the next page of SSH public keys. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of SSH public keys. Call ListNext() with this URI to + * fetch the next page of SSH public keys. + * + * @param nextLink the nextLink value to set. + * @return the SshPublicKeysGroupListResult object itself. + */ + public SshPublicKeysGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model SshPublicKeysGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusCodeCount.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusCodeCount.java new file mode 100644 index 0000000000000..ff988dbf9fcf8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusCodeCount.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StatusCodeCount model. */ +@Immutable +public final class StatusCodeCount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StatusCodeCount.class); + + /* + * The instance view status code + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * Number of instances having this status code + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /** + * Get the code property: The instance view status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the count property: Number of instances having this status code. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusLevelTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusLevelTypes.java new file mode 100644 index 0000000000000..4f39b73d0445a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StatusLevelTypes.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for StatusLevelTypes. */ +public enum StatusLevelTypes { + /** Enum value Info. */ + INFO("Info"), + + /** Enum value Warning. */ + WARNING("Warning"), + + /** Enum value Error. */ + ERROR("Error"); + + /** The actual serialized value for a StatusLevelTypes instance. */ + private final String value; + + StatusLevelTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StatusLevelTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed StatusLevelTypes object, or null if unable to parse. + */ + @JsonCreator + public static StatusLevelTypes fromString(String value) { + StatusLevelTypes[] items = StatusLevelTypes.values(); + for (StatusLevelTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountType.java new file mode 100644 index 0000000000000..4ae5b590c172c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAccountType. */ +public final class StorageAccountType extends ExpandableStringEnum { + /** Static value Standard_LRS for StorageAccountType. */ + public static final StorageAccountType STANDARD_LRS = fromString("Standard_LRS"); + + /** Static value Standard_ZRS for StorageAccountType. */ + public static final StorageAccountType STANDARD_ZRS = fromString("Standard_ZRS"); + + /** Static value Premium_LRS for StorageAccountType. */ + public static final StorageAccountType PREMIUM_LRS = fromString("Premium_LRS"); + + /** + * Creates or finds a StorageAccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAccountType. + */ + @JsonCreator + public static StorageAccountType fromString(String name) { + return fromString(name, StorageAccountType.class); + } + + /** @return known StorageAccountType values. */ + public static Collection values() { + return values(StorageAccountType.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountTypes.java new file mode 100644 index 0000000000000..ada14caf138a8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageAccountTypes.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAccountTypes. */ +public final class StorageAccountTypes extends ExpandableStringEnum { + /** Static value Standard_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); + + /** Static value Premium_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); + + /** Static value StandardSSD_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes STANDARD_SSD_LRS = fromString("StandardSSD_LRS"); + + /** Static value UltraSSD_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes ULTRA_SSD_LRS = fromString("UltraSSD_LRS"); + + /** Static value Premium_ZRS for StorageAccountTypes. */ + public static final StorageAccountTypes PREMIUM_ZRS = fromString("Premium_ZRS"); + + /** Static value StandardSSD_ZRS for StorageAccountTypes. */ + public static final StorageAccountTypes STANDARD_SSD_ZRS = fromString("StandardSSD_ZRS"); + + /** + * Creates or finds a StorageAccountTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAccountTypes. + */ + @JsonCreator + public static StorageAccountTypes fromString(String name) { + return fromString(name, StorageAccountTypes.class); + } + + /** @return known StorageAccountTypes values. */ + public static Collection values() { + return values(StorageAccountTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageProfile.java new file mode 100644 index 0000000000000..e1db0824339b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/StorageProfile.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the storage settings for the virtual machine disks. */ +@Fluent +public final class StorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageProfile.class); + + /* + * Specifies information about the image to use. You can specify + * information about platform images, marketplace images, or virtual + * machine images. This element is required when you want to use a platform + * image, marketplace image, or virtual machine image, but is not used in + * other creation operations. + */ + @JsonProperty(value = "imageReference") + private ImageReference imageReference; + + /* + * Specifies information about the operating system disk used by the + * virtual machine.

    For more information about disks, see [About + * disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "osDisk") + private OSDisk osDisk; + + /* + * Specifies the parameters that are used to add a data disk to a virtual + * machine.

    For more information about disks, see [About disks and + * VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is required when you want to use a + * platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is required when you want to use a + * platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + * + * @param imageReference the imageReference value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the osDisk property: Specifies information about the operating system disk used by the virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the osDisk value. + */ + public OSDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: Specifies information about the operating system disk used by the virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param osDisk the osDisk value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withOsDisk(OSDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: Specifies the parameters that are used to add a data disk to a virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Specifies the parameters that are used to add a data disk to a virtual machine. + * <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param dataDisks the dataDisks value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceReadOnly.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceReadOnly.java new file mode 100644 index 0000000000000..ad682b3f53ea9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceReadOnly.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SubResourceReadOnly model. */ +@Immutable +public class SubResourceReadOnly { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubResourceReadOnly.class); + + /* + * Resource Id + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceWithColocationStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceWithColocationStatus.java new file mode 100644 index 0000000000000..88d1327313ff1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SubResourceWithColocationStatus.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SubResourceWithColocationStatus model. */ +@Fluent +public final class SubResourceWithColocationStatus extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubResourceWithColocationStatus.class); + + /* + * Describes colocation status of a resource in the Proximity Placement + * Group. + */ + @JsonProperty(value = "colocationStatus") + private InstanceViewStatus colocationStatus; + + /** + * Get the colocationStatus property: Describes colocation status of a resource in the Proximity Placement Group. + * + * @return the colocationStatus value. + */ + public InstanceViewStatus colocationStatus() { + return this.colocationStatus; + } + + /** + * Set the colocationStatus property: Describes colocation status of a resource in the Proximity Placement Group. + * + * @param colocationStatus the colocationStatus value to set. + * @return the SubResourceWithColocationStatus object itself. + */ + public SubResourceWithColocationStatus withColocationStatus(InstanceViewStatus colocationStatus) { + this.colocationStatus = colocationStatus; + return this; + } + + /** {@inheritDoc} */ + @Override + public SubResourceWithColocationStatus withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (colocationStatus() != null) { + colocationStatus().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SupportedCapabilities.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SupportedCapabilities.java new file mode 100644 index 0000000000000..34e6ef229de42 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/SupportedCapabilities.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of supported capabilities (like accelerated networking) persisted on the disk resource for VM use. */ +@Fluent +public final class SupportedCapabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SupportedCapabilities.class); + + /* + * True if the image from which the OS disk is created supports accelerated + * networking. + */ + @JsonProperty(value = "acceleratedNetwork") + private Boolean acceleratedNetwork; + + /** + * Get the acceleratedNetwork property: True if the image from which the OS disk is created supports accelerated + * networking. + * + * @return the acceleratedNetwork value. + */ + public Boolean acceleratedNetwork() { + return this.acceleratedNetwork; + } + + /** + * Set the acceleratedNetwork property: True if the image from which the OS disk is created supports accelerated + * networking. + * + * @param acceleratedNetwork the acceleratedNetwork value to set. + * @return the SupportedCapabilities object itself. + */ + public SupportedCapabilities withAcceleratedNetwork(Boolean acceleratedNetwork) { + this.acceleratedNetwork = acceleratedNetwork; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TargetRegion.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TargetRegion.java new file mode 100644 index 0000000000000..9e5ecd680a0d0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TargetRegion.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the target region information. */ +@Fluent +public final class TargetRegion { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetRegion.class); + + /* + * The name of the region. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The number of replicas of the Image Version to be created per region. + * This property is updatable. + */ + @JsonProperty(value = "regionalReplicaCount") + private Integer regionalReplicaCount; + + /* + * Specifies the storage account type to be used to store the image. This + * property is not updatable. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountType storageAccountType; + + /* + * Optional. Allows users to provide customer managed keys for encrypting + * the OS and data disks in the gallery artifact. + */ + @JsonProperty(value = "encryption") + private EncryptionImages encryption; + + /** + * Get the name property: The name of the region. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the region. + * + * @param name the name value to set. + * @return the TargetRegion object itself. + */ + public TargetRegion withName(String name) { + this.name = name; + return this; + } + + /** + * Get the regionalReplicaCount property: The number of replicas of the Image Version to be created per region. This + * property is updatable. + * + * @return the regionalReplicaCount value. + */ + public Integer regionalReplicaCount() { + return this.regionalReplicaCount; + } + + /** + * Set the regionalReplicaCount property: The number of replicas of the Image Version to be created per region. This + * property is updatable. + * + * @param regionalReplicaCount the regionalReplicaCount value to set. + * @return the TargetRegion object itself. + */ + public TargetRegion withRegionalReplicaCount(Integer regionalReplicaCount) { + this.regionalReplicaCount = regionalReplicaCount; + return this; + } + + /** + * Get the storageAccountType property: Specifies the storage account type to be used to store the image. This + * property is not updatable. + * + * @return the storageAccountType value. + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type to be used to store the image. This + * property is not updatable. + * + * @param storageAccountType the storageAccountType value to set. + * @return the TargetRegion object itself. + */ + public TargetRegion withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the encryption property: Optional. Allows users to provide customer managed keys for encrypting the OS and + * data disks in the gallery artifact. + * + * @return the encryption value. + */ + public EncryptionImages encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Optional. Allows users to provide customer managed keys for encrypting the OS and + * data disks in the gallery artifact. + * + * @param encryption the encryption value to set. + * @return the TargetRegion object itself. + */ + public TargetRegion withEncryption(EncryptionImages encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model TargetRegion")); + } + if (encryption() != null) { + encryption().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TerminateNotificationProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TerminateNotificationProfile.java new file mode 100644 index 0000000000000..fa34b426afe9d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/TerminateNotificationProfile.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TerminateNotificationProfile model. */ +@Fluent +public final class TerminateNotificationProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TerminateNotificationProfile.class); + + /* + * Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is + * auto approved (timed out). The configuration must be specified in ISO + * 8601 format, the default value is 5 minutes (PT5M) + */ + @JsonProperty(value = "notBeforeTimeout") + private String notBeforeTimeout; + + /* + * Specifies whether the Terminate Scheduled event is enabled or disabled. + */ + @JsonProperty(value = "enable") + private Boolean enable; + + /** + * Get the notBeforeTimeout property: Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The + * configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M). + * + * @return the notBeforeTimeout value. + */ + public String notBeforeTimeout() { + return this.notBeforeTimeout; + } + + /** + * Set the notBeforeTimeout property: Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The + * configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M). + * + * @param notBeforeTimeout the notBeforeTimeout value to set. + * @return the TerminateNotificationProfile object itself. + */ + public TerminateNotificationProfile withNotBeforeTimeout(String notBeforeTimeout) { + this.notBeforeTimeout = notBeforeTimeout; + return this; + } + + /** + * Get the enable property: Specifies whether the Terminate Scheduled event is enabled or disabled. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Specifies whether the Terminate Scheduled event is enabled or disabled. + * + * @param enable the enable value to set. + * @return the TerminateNotificationProfile object itself. + */ + public TerminateNotificationProfile withEnable(Boolean enable) { + this.enable = enable; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ThrottledRequestsInput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ThrottledRequestsInput.java new file mode 100644 index 0000000000000..36889b0337823 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/ThrottledRequestsInput.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +/** Api request input for LogAnalytics getThrottledRequests Api. */ +@Fluent +public final class ThrottledRequestsInput extends LogAnalyticsInputBase { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThrottledRequestsInput.class); + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withBlobContainerSasUri(String blobContainerSasUri) { + super.withBlobContainerSasUri(blobContainerSasUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withFromTime(OffsetDateTime fromTime) { + super.withFromTime(fromTime); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withToTime(OffsetDateTime toTime) { + super.withToTime(toTime); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withGroupByThrottlePolicy(Boolean groupByThrottlePolicy) { + super.withGroupByThrottlePolicy(groupByThrottlePolicy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withGroupByOperationName(Boolean groupByOperationName) { + super.withGroupByOperationName(groupByOperationName); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withGroupByResourceName(Boolean groupByResourceName) { + super.withGroupByResourceName(groupByResourceName); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withGroupByClientApplicationId(Boolean groupByClientApplicationId) { + super.withGroupByClientApplicationId(groupByClientApplicationId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ThrottledRequestsInput withGroupByUserAgent(Boolean groupByUserAgent) { + super.withGroupByUserAgent(groupByUserAgent); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UefiSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UefiSettings.java new file mode 100644 index 0000000000000..16b75d3f98ac6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UefiSettings.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the security settings like secure boot and vTPM used while creating the virtual machine. + * <br><br>Minimum api-version: 2020-12-01. + */ +@Fluent +public final class UefiSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UefiSettings.class); + + /* + * Specifies whether secure boot should be enabled on the virtual machine. + *

    Minimum api-version: 2020-12-01 + */ + @JsonProperty(value = "secureBootEnabled") + private Boolean secureBootEnabled; + + /* + * Specifies whether vTPM should be enabled on the virtual machine. + *

    Minimum api-version: 2020-12-01 + */ + @JsonProperty(value = "vTpmEnabled") + private Boolean vTpmEnabled; + + /** + * Get the secureBootEnabled property: Specifies whether secure boot should be enabled on the virtual machine. + * <br><br>Minimum api-version: 2020-12-01. + * + * @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. + * <br><br>Minimum api-version: 2020-12-01. + * + * @param secureBootEnabled the secureBootEnabled value to set. + * @return the UefiSettings object itself. + */ + public UefiSettings withSecureBootEnabled(Boolean secureBootEnabled) { + this.secureBootEnabled = secureBootEnabled; + return this; + } + + /** + * Get the vTpmEnabled property: Specifies whether vTPM should be enabled on the virtual machine. + * <br><br>Minimum api-version: 2020-12-01. + * + * @return the vTpmEnabled value. + */ + public Boolean vTpmEnabled() { + return this.vTpmEnabled; + } + + /** + * Set the vTpmEnabled property: Specifies whether vTPM should be enabled on the virtual machine. + * <br><br>Minimum api-version: 2020-12-01. + * + * @param vTpmEnabled the vTpmEnabled value to set. + * @return the UefiSettings object itself. + */ + public UefiSettings withVTpmEnabled(Boolean vTpmEnabled) { + this.vTpmEnabled = vTpmEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomain.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomain.java new file mode 100644 index 0000000000000..cde640c51f4d5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomain.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner; + +/** An immutable client-side representation of UpdateDomain. */ +public interface UpdateDomain { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource Name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner object. + * + * @return the inner object. + */ + UpdateDomainInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomainListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomainListResult.java new file mode 100644 index 0000000000000..467192bebed33 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateDomainListResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.UpdateDomainInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The UpdateDomainListResult model. */ +@Fluent +public final class UpdateDomainListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateDomainListResult.class); + + /* + * The value property. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The nextLink property. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the UpdateDomainListResult object itself. + */ + public UpdateDomainListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the UpdateDomainListResult object itself. + */ + public UpdateDomainListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model UpdateDomainListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResource.java new file mode 100644 index 0000000000000..38ababea6413e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Update Resource model definition. */ +@Fluent +public class UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 UpdateResource object itself. + */ + public UpdateResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResourceDefinition.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResourceDefinition.java new file mode 100644 index 0000000000000..3ee7e39faba2c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpdateResourceDefinition.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Update Resource model definition. */ +@Fluent +public class UpdateResourceDefinition extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateResourceDefinition.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 UpdateResourceDefinition object itself. + */ + public UpdateResourceDefinition withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeMode.java new file mode 100644 index 0000000000000..85463733f4969 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for UpgradeMode. */ +public enum UpgradeMode { + /** Enum value Automatic. */ + AUTOMATIC("Automatic"), + + /** Enum value Manual. */ + MANUAL("Manual"), + + /** Enum value Rolling. */ + ROLLING("Rolling"); + + /** The actual serialized value for a UpgradeMode instance. */ + private final String value; + + UpgradeMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UpgradeMode instance. + * + * @param value the serialized value to parse. + * @return the parsed UpgradeMode object, or null if unable to parse. + */ + @JsonCreator + public static UpgradeMode fromString(String value) { + UpgradeMode[] items = UpgradeMode.values(); + for (UpgradeMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfo.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfo.java new file mode 100644 index 0000000000000..519634a9b0715 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfo.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; + +/** An immutable client-side representation of UpgradeOperationHistoricalStatusInfo. */ +public interface UpgradeOperationHistoricalStatusInfo { + /** + * Gets the properties property: Information about the properties of the upgrade operation. + * + * @return the properties value. + */ + UpgradeOperationHistoricalStatusInfoProperties properties(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the inner + * com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner object. + * + * @return the inner object. + */ + UpgradeOperationHistoricalStatusInfoInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfoProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfoProperties.java new file mode 100644 index 0000000000000..c8448bd0692f0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoricalStatusInfoProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes each OS upgrade on the Virtual Machine Scale Set. */ +@Immutable +public final class UpgradeOperationHistoricalStatusInfoProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(UpgradeOperationHistoricalStatusInfoProperties.class); + + /* + * Information about the overall status of the upgrade operation. + */ + @JsonProperty(value = "runningStatus", access = JsonProperty.Access.WRITE_ONLY) + private UpgradeOperationHistoryStatus runningStatus; + + /* + * Counts of the VMs in each state. + */ + @JsonProperty(value = "progress", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeProgressInfo progress; + + /* + * Error Details for this upgrade if there are any. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /* + * Invoker of the Upgrade Operation + */ + @JsonProperty(value = "startedBy", access = JsonProperty.Access.WRITE_ONLY) + private UpgradeOperationInvoker startedBy; + + /* + * Image Reference details + */ + @JsonProperty(value = "targetImageReference", access = JsonProperty.Access.WRITE_ONLY) + private ImageReference targetImageReference; + + /* + * Information about OS rollback if performed + */ + @JsonProperty(value = "rollbackInfo", access = JsonProperty.Access.WRITE_ONLY) + private RollbackStatusInfo rollbackInfo; + + /** + * Get the runningStatus property: Information about the overall status of the upgrade operation. + * + * @return the runningStatus value. + */ + public UpgradeOperationHistoryStatus runningStatus() { + return this.runningStatus; + } + + /** + * Get the progress property: Counts of the VMs in each state. + * + * @return the progress value. + */ + public RollingUpgradeProgressInfo progress() { + return this.progress; + } + + /** + * Get the error property: Error Details for this upgrade if there are any. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Get the startedBy property: Invoker of the Upgrade Operation. + * + * @return the startedBy value. + */ + public UpgradeOperationInvoker startedBy() { + return this.startedBy; + } + + /** + * Get the targetImageReference property: Image Reference details. + * + * @return the targetImageReference value. + */ + public ImageReference targetImageReference() { + return this.targetImageReference; + } + + /** + * Get the rollbackInfo property: Information about OS rollback if performed. + * + * @return the rollbackInfo value. + */ + public RollbackStatusInfo rollbackInfo() { + return this.rollbackInfo; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (runningStatus() != null) { + runningStatus().validate(); + } + if (progress() != null) { + progress().validate(); + } + if (error() != null) { + error().validate(); + } + if (targetImageReference() != null) { + targetImageReference().validate(); + } + if (rollbackInfo() != null) { + rollbackInfo().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoryStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoryStatus.java new file mode 100644 index 0000000000000..60f4607774649 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationHistoryStatus.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Information about the current running state of the overall upgrade. */ +@Immutable +public final class UpgradeOperationHistoryStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpgradeOperationHistoryStatus.class); + + /* + * Code indicating the current status of the upgrade. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private UpgradeState code; + + /* + * Start time of the upgrade. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * End time of the upgrade. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /** + * Get the code property: Code indicating the current status of the upgrade. + * + * @return the code value. + */ + public UpgradeState code() { + return this.code; + } + + /** + * Get the startTime property: Start time of the upgrade. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: End time of the upgrade. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationInvoker.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationInvoker.java new file mode 100644 index 0000000000000..707571af674db --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeOperationInvoker.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for UpgradeOperationInvoker. */ +public enum UpgradeOperationInvoker { + /** Enum value Unknown. */ + UNKNOWN("Unknown"), + + /** Enum value User. */ + USER("User"), + + /** Enum value Platform. */ + PLATFORM("Platform"); + + /** The actual serialized value for a UpgradeOperationInvoker instance. */ + private final String value; + + UpgradeOperationInvoker(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UpgradeOperationInvoker instance. + * + * @param value the serialized value to parse. + * @return the parsed UpgradeOperationInvoker object, or null if unable to parse. + */ + @JsonCreator + public static UpgradeOperationInvoker fromString(String value) { + UpgradeOperationInvoker[] items = UpgradeOperationInvoker.values(); + for (UpgradeOperationInvoker item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradePolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradePolicy.java new file mode 100644 index 0000000000000..f669fa8af9c01 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradePolicy.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an upgrade policy - automatic, manual, or rolling. */ +@Fluent +public final class UpgradePolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpgradePolicy.class); + + /* + * Specifies the mode of an upgrade to virtual machines in the scale + * set.

    Possible values are:

    **Manual** - You + * control the application of updates to virtual machines in the scale set. + * You do this by using the manualUpgrade action.

    **Automatic** + * - All virtual machines in the scale set are automatically updated at + * the same time. + */ + @JsonProperty(value = "mode") + private UpgradeMode mode; + + /* + * The configuration parameters used while performing a rolling upgrade. + */ + @JsonProperty(value = "rollingUpgradePolicy") + private RollingUpgradePolicy rollingUpgradePolicy; + + /* + * Configuration parameters used for performing automatic OS Upgrade. + */ + @JsonProperty(value = "automaticOSUpgradePolicy") + private AutomaticOSUpgradePolicy automaticOSUpgradePolicy; + + /** + * Get the mode property: Specifies the mode of an upgrade to virtual machines in the scale set.<br /><br + * /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual + * machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - + * All virtual machines in the scale set are automatically updated at the same time. + * + * @return the mode value. + */ + public UpgradeMode mode() { + return this.mode; + } + + /** + * Set the mode property: Specifies the mode of an upgrade to virtual machines in the scale set.<br /><br + * /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual + * machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - + * All virtual machines in the scale set are automatically updated at the same time. + * + * @param mode the mode value to set. + * @return the UpgradePolicy object itself. + */ + public UpgradePolicy withMode(UpgradeMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the rollingUpgradePolicy property: The configuration parameters used while performing a rolling upgrade. + * + * @return the rollingUpgradePolicy value. + */ + public RollingUpgradePolicy rollingUpgradePolicy() { + return this.rollingUpgradePolicy; + } + + /** + * Set the rollingUpgradePolicy property: The configuration parameters used while performing a rolling upgrade. + * + * @param rollingUpgradePolicy the rollingUpgradePolicy value to set. + * @return the UpgradePolicy object itself. + */ + public UpgradePolicy withRollingUpgradePolicy(RollingUpgradePolicy rollingUpgradePolicy) { + this.rollingUpgradePolicy = rollingUpgradePolicy; + return this; + } + + /** + * Get the automaticOSUpgradePolicy property: Configuration parameters used for performing automatic OS Upgrade. + * + * @return the automaticOSUpgradePolicy value. + */ + public AutomaticOSUpgradePolicy automaticOSUpgradePolicy() { + return this.automaticOSUpgradePolicy; + } + + /** + * Set the automaticOSUpgradePolicy property: Configuration parameters used for performing automatic OS Upgrade. + * + * @param automaticOSUpgradePolicy the automaticOSUpgradePolicy value to set. + * @return the UpgradePolicy object itself. + */ + public UpgradePolicy withAutomaticOSUpgradePolicy(AutomaticOSUpgradePolicy automaticOSUpgradePolicy) { + this.automaticOSUpgradePolicy = automaticOSUpgradePolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rollingUpgradePolicy() != null) { + rollingUpgradePolicy().validate(); + } + if (automaticOSUpgradePolicy() != null) { + automaticOSUpgradePolicy().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeState.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeState.java new file mode 100644 index 0000000000000..da6df9be090c4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UpgradeState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for UpgradeState. */ +public enum UpgradeState { + /** Enum value RollingForward. */ + ROLLING_FORWARD("RollingForward"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"), + + /** Enum value Completed. */ + COMPLETED("Completed"), + + /** Enum value Faulted. */ + FAULTED("Faulted"); + + /** The actual serialized value for a UpgradeState instance. */ + private final String value; + + UpgradeState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UpgradeState instance. + * + * @param value the serialized value to parse. + * @return the parsed UpgradeState object, or null if unable to parse. + */ + @JsonCreator + public static UpgradeState fromString(String value) { + UpgradeState[] items = UpgradeState.values(); + for (UpgradeState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usage.java new file mode 100644 index 0000000000000..8f5828c3804ae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usage.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the unit property: An enum describing the unit of usage measurement. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: The current usage of the resource. + * + * @return the currentValue value. + */ + int currentValue(); + + /** + * Gets the limit property: The maximum permitted usage of the resource. + * + * @return the limit value. + */ + long limit(); + + /** + * Gets the name property: The name of the type of usage. + * + * @return the name value. + */ + UsageName name(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UsageName.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UsageName.java new file mode 100644 index 0000000000000..5a923bc10431e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UsageName.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Usage Names. */ +@Fluent +public final class UsageName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageName.class); + + /* + * The name of the resource. + */ + @JsonProperty(value = "value") + private String value; + + /* + * The localized name of the resource. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the value property: The name of the resource. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The name of the resource. + * + * @param value the value value to set. + * @return the UsageName object itself. + */ + public UsageName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: The localized name of the resource. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: The localized name of the resource. + * + * @param localizedValue the localizedValue value to set. + * @return the UsageName object itself. + */ + public UsageName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usages.java new file mode 100644 index 0000000000000..2912b40f8107a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/Usages.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Usages. */ +public interface Usages { + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + PagedIterable list(String location); + + /** + * Gets, for the specified location, the current compute resource usage information as well as the limits for + * compute resources under the subscription. + * + * @param location The location for which resource usage is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Usages operation response. + */ + PagedIterable list(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactManage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactManage.java new file mode 100644 index 0000000000000..7c3b3e2070886 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactManage.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserArtifactManage model. */ +@Fluent +public final class UserArtifactManage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserArtifactManage.class); + + /* + * Required. The path and arguments to install the gallery application. + * This is limited to 4096 characters. + */ + @JsonProperty(value = "install", required = true) + private String install; + + /* + * Required. The path and arguments to remove the gallery application. This + * is limited to 4096 characters. + */ + @JsonProperty(value = "remove", required = true) + private String remove; + + /* + * Optional. The path and arguments to update the gallery application. If + * not present, then update operation will invoke remove command on the + * previous version and install command on the current version of the + * gallery application. This is limited to 4096 characters. + */ + @JsonProperty(value = "update") + private String update; + + /** + * Get the install property: Required. The path and arguments to install the gallery application. This is limited to + * 4096 characters. + * + * @return the install value. + */ + public String install() { + return this.install; + } + + /** + * Set the install property: Required. The path and arguments to install the gallery application. This is limited to + * 4096 characters. + * + * @param install the install value to set. + * @return the UserArtifactManage object itself. + */ + public UserArtifactManage withInstall(String install) { + this.install = install; + return this; + } + + /** + * Get the remove property: Required. The path and arguments to remove the gallery application. This is limited to + * 4096 characters. + * + * @return the remove value. + */ + public String remove() { + return this.remove; + } + + /** + * Set the remove property: Required. The path and arguments to remove the gallery application. This is limited to + * 4096 characters. + * + * @param remove the remove value to set. + * @return the UserArtifactManage object itself. + */ + public UserArtifactManage withRemove(String remove) { + this.remove = remove; + return this; + } + + /** + * Get the update property: Optional. The path and arguments to update the gallery application. If not present, then + * update operation will invoke remove command on the previous version and install command on the current version of + * the gallery application. This is limited to 4096 characters. + * + * @return the update value. + */ + public String update() { + return this.update; + } + + /** + * Set the update property: Optional. The path and arguments to update the gallery application. If not present, then + * update operation will invoke remove command on the previous version and install command on the current version of + * the gallery application. This is limited to 4096 characters. + * + * @param update the update value to set. + * @return the UserArtifactManage object itself. + */ + public UserArtifactManage withUpdate(String update) { + this.update = update; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (install() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property install in model UserArtifactManage")); + } + if (remove() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property remove in model UserArtifactManage")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactSource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactSource.java new file mode 100644 index 0000000000000..f21dd4242e11b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserArtifactSource.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The source image from which the Image Version is going to be created. */ +@Fluent +public final class UserArtifactSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserArtifactSource.class); + + /* + * Required. The mediaLink of the artifact, must be a readable storage page + * blob. + */ + @JsonProperty(value = "mediaLink", required = true) + private String mediaLink; + + /* + * Optional. The defaultConfigurationLink of the artifact, must be a + * readable storage page blob. + */ + @JsonProperty(value = "defaultConfigurationLink") + private String defaultConfigurationLink; + + /** + * Get the mediaLink property: Required. The mediaLink of the artifact, must be a readable storage page blob. + * + * @return the mediaLink value. + */ + public String mediaLink() { + return this.mediaLink; + } + + /** + * Set the mediaLink property: Required. The mediaLink of the artifact, must be a readable storage page blob. + * + * @param mediaLink the mediaLink value to set. + * @return the UserArtifactSource object itself. + */ + public UserArtifactSource withMediaLink(String mediaLink) { + this.mediaLink = mediaLink; + return this; + } + + /** + * Get the defaultConfigurationLink property: Optional. The defaultConfigurationLink of the artifact, must be a + * readable storage page blob. + * + * @return the defaultConfigurationLink value. + */ + public String defaultConfigurationLink() { + return this.defaultConfigurationLink; + } + + /** + * Set the defaultConfigurationLink property: Optional. The defaultConfigurationLink of the artifact, must be a + * readable storage page blob. + * + * @param defaultConfigurationLink the defaultConfigurationLink value to set. + * @return the UserArtifactSource object itself. + */ + public UserArtifactSource withDefaultConfigurationLink(String defaultConfigurationLink) { + this.defaultConfigurationLink = defaultConfigurationLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mediaLink() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property mediaLink in model UserArtifactSource")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserAssignedIdentitiesValue.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..24ec31e85ce72 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/UserAssignedIdentitiesValue.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserAssignedIdentitiesValue model. */ +@Immutable +public final class UserAssignedIdentitiesValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAssignedIdentitiesValue.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user 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() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMDiskSecurityProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMDiskSecurityProfile.java new file mode 100644 index 0000000000000..286f5e61e6f5c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMDiskSecurityProfile.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the security profile settings for the managed disk. <br><br> NOTE: It can only be set for + * Confidential VMs. + */ +@Fluent +public final class VMDiskSecurityProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VMDiskSecurityProfile.class); + + /* + * Specifies the EncryptionType of the managed disk.
    It is set to + * DiskWithVMGuestState for encryption of the managed disk along with + * VMGuestState blob, and VMGuestStateOnly for encryption of just the + * VMGuestState blob.

    NOTE: It can be set for only Confidential + * VMs. + */ + @JsonProperty(value = "securityEncryptionType") + private SecurityEncryptionTypes securityEncryptionType; + + /* + * Specifies the customer managed disk encryption set resource id for the + * managed disk that is used for Customer Managed Key encrypted + * ConfidentialVM OS Disk and VMGuest blob. + */ + @JsonProperty(value = "diskEncryptionSet") + private DiskEncryptionSetParameters diskEncryptionSet; + + /** + * Get the securityEncryptionType property: Specifies the EncryptionType of the managed disk. <br> It is set + * to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly for + * encryption of just the VMGuestState blob. <br><br> NOTE: It can be set for only Confidential VMs. + * + * @return the securityEncryptionType value. + */ + public SecurityEncryptionTypes securityEncryptionType() { + return this.securityEncryptionType; + } + + /** + * Set the securityEncryptionType property: Specifies the EncryptionType of the managed disk. <br> It is set + * to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly for + * encryption of just the VMGuestState blob. <br><br> NOTE: It can be set for only Confidential VMs. + * + * @param securityEncryptionType the securityEncryptionType value to set. + * @return the VMDiskSecurityProfile object itself. + */ + public VMDiskSecurityProfile withSecurityEncryptionType(SecurityEncryptionTypes securityEncryptionType) { + this.securityEncryptionType = securityEncryptionType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the VMDiskSecurityProfile object itself. + */ + public VMDiskSecurityProfile withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGalleryApplication.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGalleryApplication.java new file mode 100644 index 0000000000000..478939fb11edb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGalleryApplication.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the required information to reference a compute gallery application version. */ +@Fluent +public final class VMGalleryApplication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VMGalleryApplication.class); + + /* + * Optional, Specifies a passthrough value for more generic context. + */ + @JsonProperty(value = "tags") + private String tags; + + /* + * Optional, Specifies the order in which the packages have to be installed + */ + @JsonProperty(value = "order") + private Integer order; + + /* + * Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + */ + @JsonProperty(value = "packageReferenceId", required = true) + private String packageReferenceId; + + /* + * Optional, Specifies the uri to an azure blob that will replace the + * default configuration for the package if provided + */ + @JsonProperty(value = "configurationReference") + private String configurationReference; + + /** + * Get the tags property: Optional, Specifies a passthrough value for more generic context. + * + * @return the tags value. + */ + public String tags() { + return this.tags; + } + + /** + * Set the tags property: Optional, Specifies a passthrough value for more generic context. + * + * @param tags the tags value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withTags(String tags) { + this.tags = tags; + return this; + } + + /** + * Get the order property: Optional, Specifies the order in which the packages have to be installed. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: Optional, Specifies the order in which the packages have to be installed. + * + * @param order the order value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the packageReferenceId property: Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + * + * @return the packageReferenceId value. + */ + public String packageReferenceId() { + return this.packageReferenceId; + } + + /** + * Set the packageReferenceId property: Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + * + * @param packageReferenceId the packageReferenceId value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withPackageReferenceId(String packageReferenceId) { + this.packageReferenceId = packageReferenceId; + return this; + } + + /** + * Get the configurationReference property: Optional, Specifies the uri to an azure blob that will replace the + * default configuration for the package if provided. + * + * @return the configurationReference value. + */ + public String configurationReference() { + return this.configurationReference; + } + + /** + * Set the configurationReference property: Optional, Specifies the uri to an azure blob that will replace the + * default configuration for the package if provided. + * + * @param configurationReference the configurationReference value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withConfigurationReference(String configurationReference) { + this.configurationReference = configurationReference; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (packageReferenceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property packageReferenceId in model VMGalleryApplication")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationLinux.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationLinux.java new file mode 100644 index 0000000000000..47e499a478e92 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationLinux.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VMGuestPatchClassificationLinux. */ +public final class VMGuestPatchClassificationLinux extends ExpandableStringEnum { + /** Static value Critical for VMGuestPatchClassificationLinux. */ + public static final VMGuestPatchClassificationLinux CRITICAL = fromString("Critical"); + + /** Static value Security for VMGuestPatchClassificationLinux. */ + public static final VMGuestPatchClassificationLinux SECURITY = fromString("Security"); + + /** Static value Other for VMGuestPatchClassificationLinux. */ + public static final VMGuestPatchClassificationLinux OTHER = fromString("Other"); + + /** + * Creates or finds a VMGuestPatchClassificationLinux from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMGuestPatchClassificationLinux. + */ + @JsonCreator + public static VMGuestPatchClassificationLinux fromString(String name) { + return fromString(name, VMGuestPatchClassificationLinux.class); + } + + /** @return known VMGuestPatchClassificationLinux values. */ + public static Collection values() { + return values(VMGuestPatchClassificationLinux.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationWindows.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationWindows.java new file mode 100644 index 0000000000000..a33d6037ab122 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchClassificationWindows.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VMGuestPatchClassificationWindows. */ +public final class VMGuestPatchClassificationWindows extends ExpandableStringEnum { + /** Static value Critical for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows CRITICAL = fromString("Critical"); + + /** Static value Security for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows SECURITY = fromString("Security"); + + /** Static value UpdateRollUp for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows UPDATE_ROLL_UP = fromString("UpdateRollUp"); + + /** Static value FeaturePack for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows FEATURE_PACK = fromString("FeaturePack"); + + /** Static value ServicePack for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows SERVICE_PACK = fromString("ServicePack"); + + /** Static value Definition for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows DEFINITION = fromString("Definition"); + + /** Static value Tools for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows TOOLS = fromString("Tools"); + + /** Static value Updates for VMGuestPatchClassificationWindows. */ + public static final VMGuestPatchClassificationWindows UPDATES = fromString("Updates"); + + /** + * Creates or finds a VMGuestPatchClassificationWindows from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMGuestPatchClassificationWindows. + */ + @JsonCreator + public static VMGuestPatchClassificationWindows fromString(String name) { + return fromString(name, VMGuestPatchClassificationWindows.class); + } + + /** @return known VMGuestPatchClassificationWindows values. */ + public static Collection values() { + return values(VMGuestPatchClassificationWindows.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootBehavior.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootBehavior.java new file mode 100644 index 0000000000000..238062dc003dd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootBehavior.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VMGuestPatchRebootBehavior. */ +public final class VMGuestPatchRebootBehavior extends ExpandableStringEnum { + /** Static value Unknown for VMGuestPatchRebootBehavior. */ + public static final VMGuestPatchRebootBehavior UNKNOWN = fromString("Unknown"); + + /** Static value NeverReboots for VMGuestPatchRebootBehavior. */ + public static final VMGuestPatchRebootBehavior NEVER_REBOOTS = fromString("NeverReboots"); + + /** Static value AlwaysRequiresReboot for VMGuestPatchRebootBehavior. */ + public static final VMGuestPatchRebootBehavior ALWAYS_REQUIRES_REBOOT = fromString("AlwaysRequiresReboot"); + + /** Static value CanRequestReboot for VMGuestPatchRebootBehavior. */ + public static final VMGuestPatchRebootBehavior CAN_REQUEST_REBOOT = fromString("CanRequestReboot"); + + /** + * Creates or finds a VMGuestPatchRebootBehavior from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMGuestPatchRebootBehavior. + */ + @JsonCreator + public static VMGuestPatchRebootBehavior fromString(String name) { + return fromString(name, VMGuestPatchRebootBehavior.class); + } + + /** @return known VMGuestPatchRebootBehavior values. */ + public static Collection values() { + return values(VMGuestPatchRebootBehavior.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootSetting.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootSetting.java new file mode 100644 index 0000000000000..fa17f7be7eb8a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootSetting.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VMGuestPatchRebootSetting. */ +public final class VMGuestPatchRebootSetting extends ExpandableStringEnum { + /** Static value IfRequired for VMGuestPatchRebootSetting. */ + public static final VMGuestPatchRebootSetting IF_REQUIRED = fromString("IfRequired"); + + /** Static value Never for VMGuestPatchRebootSetting. */ + public static final VMGuestPatchRebootSetting NEVER = fromString("Never"); + + /** Static value Always for VMGuestPatchRebootSetting. */ + public static final VMGuestPatchRebootSetting ALWAYS = fromString("Always"); + + /** + * Creates or finds a VMGuestPatchRebootSetting from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMGuestPatchRebootSetting. + */ + @JsonCreator + public static VMGuestPatchRebootSetting fromString(String name) { + return fromString(name, VMGuestPatchRebootSetting.class); + } + + /** @return known VMGuestPatchRebootSetting values. */ + public static Collection values() { + return values(VMGuestPatchRebootSetting.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootStatus.java new file mode 100644 index 0000000000000..1e5cbe59a3ccd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMGuestPatchRebootStatus.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VMGuestPatchRebootStatus. */ +public final class VMGuestPatchRebootStatus extends ExpandableStringEnum { + /** Static value Unknown for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus UNKNOWN = fromString("Unknown"); + + /** Static value NotNeeded for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus NOT_NEEDED = fromString("NotNeeded"); + + /** Static value Required for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus REQUIRED = fromString("Required"); + + /** Static value Started for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus STARTED = fromString("Started"); + + /** Static value Failed for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus FAILED = fromString("Failed"); + + /** Static value Completed for VMGuestPatchRebootStatus. */ + public static final VMGuestPatchRebootStatus COMPLETED = fromString("Completed"); + + /** + * Creates or finds a VMGuestPatchRebootStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMGuestPatchRebootStatus. + */ + @JsonCreator + public static VMGuestPatchRebootStatus fromString(String name) { + return fromString(name, VMGuestPatchRebootStatus.class); + } + + /** @return known VMGuestPatchRebootStatus values. */ + public static Collection values() { + return values(VMGuestPatchRebootStatus.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMScaleSetConvertToSinglePlacementGroupInput.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMScaleSetConvertToSinglePlacementGroupInput.java new file mode 100644 index 0000000000000..c2b53755f2a59 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMScaleSetConvertToSinglePlacementGroupInput.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The VMScaleSetConvertToSinglePlacementGroupInput model. */ +@Fluent +public final class VMScaleSetConvertToSinglePlacementGroupInput { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VMScaleSetConvertToSinglePlacementGroupInput.class); + + /* + * Id of the placement group in which you want future virtual machine + * instances to be placed. To query placement group Id, please use Virtual + * Machine Scale Set VMs - Get API. If not provided, the platform will + * choose one with maximum number of virtual machine instances. + */ + @JsonProperty(value = "activePlacementGroupId") + private String activePlacementGroupId; + + /** + * Get the activePlacementGroupId property: Id of the placement group in which you want future virtual machine + * instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not + * provided, the platform will choose one with maximum number of virtual machine instances. + * + * @return the activePlacementGroupId value. + */ + public String activePlacementGroupId() { + return this.activePlacementGroupId; + } + + /** + * Set the activePlacementGroupId property: Id of the placement group in which you want future virtual machine + * instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not + * provided, the platform will choose one with maximum number of virtual machine instances. + * + * @param activePlacementGroupId the activePlacementGroupId value to set. + * @return the VMScaleSetConvertToSinglePlacementGroupInput object itself. + */ + public VMScaleSetConvertToSinglePlacementGroupInput withActivePlacementGroupId(String activePlacementGroupId) { + this.activePlacementGroupId = activePlacementGroupId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMSizeProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMSizeProperties.java new file mode 100644 index 0000000000000..6ada86486363b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VMSizeProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies VM Size Property settings on the virtual machine. */ +@Fluent +public final class VMSizeProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VMSizeProperties.class); + + /* + * Specifies the number of vCPUs available for the VM.

    When this + * property is not specified in the request body the default behavior is to + * set it to the value of vCPUs available for that VM size exposed in api + * response of [List all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) + * . + */ + @JsonProperty(value = "vCPUsAvailable") + private Integer vCpusAvailable; + + /* + * Specifies the vCPU to physical core ratio.

    When this property + * is not specified in the request body the default behavior is set to the + * value of vCPUsPerCore for the VM Size exposed in api response of [List + * all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) + *

    Setting this property to 1 also means that hyper-threading is + * disabled. + */ + @JsonProperty(value = "vCPUsPerCore") + private Integer vCpusPerCore; + + /** + * Get the vCpusAvailable property: Specifies the number of vCPUs available for the VM. <br><br> When + * this property is not specified in the request body the default behavior is to set it to the value of vCPUs + * available for that VM size exposed in api response of [List all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) . + * + * @return the vCpusAvailable value. + */ + public Integer vCpusAvailable() { + return this.vCpusAvailable; + } + + /** + * Set the vCpusAvailable property: Specifies the number of vCPUs available for the VM. <br><br> When + * this property is not specified in the request body the default behavior is to set it to the value of vCPUs + * available for that VM size exposed in api response of [List all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) . + * + * @param vCpusAvailable the vCpusAvailable value to set. + * @return the VMSizeProperties object itself. + */ + public VMSizeProperties withVCpusAvailable(Integer vCpusAvailable) { + this.vCpusAvailable = vCpusAvailable; + return this; + } + + /** + * Get the vCpusPerCore property: Specifies the vCPU to physical core ratio. <br><br> When this property + * is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the VM Size + * exposed in api response of [List all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) <br><br> Setting this + * property to 1 also means that hyper-threading is disabled. + * + * @return the vCpusPerCore value. + */ + public Integer vCpusPerCore() { + return this.vCpusPerCore; + } + + /** + * Set the vCpusPerCore property: Specifies the vCPU to physical core ratio. <br><br> When this property + * is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the VM Size + * exposed in api response of [List all available virtual machine sizes in a + * region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list) <br><br> Setting this + * property to 1 also means that hyper-threading is disabled. + * + * @param vCpusPerCore the vCpusPerCore value to set. + * @return the VMSizeProperties object itself. + */ + public VMSizeProperties withVCpusPerCore(Integer vCpusPerCore) { + this.vCpusPerCore = vCpusPerCore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultCertificate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultCertificate.java new file mode 100644 index 0000000000000..589ab3209c03c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultCertificate.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. */ +@Fluent +public final class VaultCertificate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultCertificate.class); + + /* + * This is the URL of a certificate that has been uploaded to Key Vault as + * a secret. For adding a secret to the Key Vault, see [Add a key or secret + * to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be It is the Base64 encoding of + * the following JSON Object which is encoded in UTF-8:

    {
    + * "data":"",
    "dataType":"pfx",
    + * "password":""
    }
    To install certificates on a + * virtual machine it is recommended to use the [Azure Key Vault virtual + * machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + @JsonProperty(value = "certificateUrl") + private String certificateUrl; + + /* + * For Windows VMs, specifies the certificate store on the Virtual Machine + * to which the certificate should be added. The specified certificate + * store is implicitly in the LocalMachine account.

    For Linux VMs, + * the certificate file is placed under the /var/lib/waagent directory, + * with the file name <UppercaseThumbprint>.crt for the X509 + * certificate file and <UppercaseThumbprint>.prv for private key. + * Both of these files are .pem formatted. + */ + @JsonProperty(value = "certificateStore") + private String certificateStore; + + /** + * Get the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate + * needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + * <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> + * "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates + * on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the certificateUrl value. + */ + public String certificateUrl() { + return this.certificateUrl; + } + + /** + * Set the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate + * needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + * <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> + * "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates + * on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param certificateUrl the certificateUrl value to set. + * @return the VaultCertificate object itself. + */ + public VaultCertificate withCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + return this; + } + + /** + * Get the certificateStore property: For Windows VMs, specifies the certificate store on the Virtual Machine to + * which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. + * <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the + * file name &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and + * &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem formatted. + * + * @return the certificateStore value. + */ + public String certificateStore() { + return this.certificateStore; + } + + /** + * Set the certificateStore property: For Windows VMs, specifies the certificate store on the Virtual Machine to + * which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. + * <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the + * file name &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and + * &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem formatted. + * + * @param certificateStore the certificateStore value to set. + * @return the VaultCertificate object itself. + */ + public VaultCertificate withCertificateStore(String certificateStore) { + this.certificateStore = certificateStore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultSecretGroup.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultSecretGroup.java new file mode 100644 index 0000000000000..fd78434ef6671 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VaultSecretGroup.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a set of certificates which are all in the same Key Vault. */ +@Fluent +public final class VaultSecretGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VaultSecretGroup.class); + + /* + * The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + */ + @JsonProperty(value = "sourceVault") + private SubResource sourceVault; + + /* + * The list of key vault references in SourceVault which contain + * certificates. + */ + @JsonProperty(value = "vaultCertificates") + private List vaultCertificates; + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @param sourceVault the sourceVault value to set. + * @return the VaultSecretGroup object itself. + */ + public VaultSecretGroup withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @return the vaultCertificates value. + */ + public List vaultCertificates() { + return this.vaultCertificates; + } + + /** + * Set the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @param vaultCertificates the vaultCertificates value to set. + * @return the VaultSecretGroup object itself. + */ + public VaultSecretGroup withVaultCertificates(List vaultCertificates) { + this.vaultCertificates = vaultCertificates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vaultCertificates() != null) { + vaultCertificates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualHardDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualHardDisk.java new file mode 100644 index 0000000000000..f055459d7f0e3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualHardDisk.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the uri of a disk. */ +@Fluent +public final class VirtualHardDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualHardDisk.class); + + /* + * Specifies the virtual hard disk's uri. + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the uri property: Specifies the virtual hard disk's uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: Specifies the virtual hard disk's uri. + * + * @param uri the uri value to set. + * @return the VirtualHardDisk object itself. + */ + public VirtualHardDisk withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachine.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachine.java new file mode 100644 index 0000000000000..1de9ab1096d52 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachine.java @@ -0,0 +1,1641 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachine. */ +public interface VirtualMachine { + /** + * 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 plan property: Specifies information about the marketplace image used to create the virtual machine. + * This element is only used for marketplace images. Before you can use a marketplace image from an API, you must + * enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and + * then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the resources property: The virtual machine child extension resources. + * + * @return the resources value. + */ + List resources(); + + /** + * Gets the identity property: The identity of the virtual machine, if configured. + * + * @return the identity value. + */ + VirtualMachineIdentity identity(); + + /** + * Gets the zones property: The virtual machine zones. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the extendedLocation property: The extended location of the Virtual Machine. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the osProfile property: Specifies the operating system settings used while creating the virtual machine. + * Some of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + SecurityProfile securityProfile(); + + /** + * Gets the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + DiagnosticsProfile diagnosticsProfile(); + + /** + * Gets the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + SubResource availabilitySet(); + + /** + * Gets the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + SubResource virtualMachineScaleSet(); + + /** + * Gets the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + SubResource proximityPlacementGroup(); + + /** + * Gets the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + VirtualMachinePriorityTypes priority(); + + /** + * Gets the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + VirtualMachineEvictionPolicyTypes evictionPolicy(); + + /** + * Gets the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + BillingProfile billingProfile(); + + /** + * Gets the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + SubResource host(); + + /** + * Gets the hostGroup property: Specifies information about the dedicated host group that the virtual machine + * resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify + * both host and hostGroup properties. + * + * @return the hostGroup value. + */ + SubResource hostGroup(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + VirtualMachineInstanceView instanceView(); + + /** + * Gets the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + String licenseType(); + + /** + * Gets the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + String extensionsTimeBudget(); + + /** + * Gets the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual + * Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that + * best maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + ScheduledEventsProfile scheduledEventsProfile(); + + /** + * Gets the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + String userData(); + + /** + * Gets the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + CapacityReservationProfile capacityReservation(); + + /** + * Gets the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + ApplicationProfile applicationProfile(); + + /** + * Gets the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner object. + * + * @return the inner object. + */ + VirtualMachineInner innerModel(); + + /** The entirety of the VirtualMachine definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The VirtualMachine definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachine definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachine 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 VirtualMachine definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the VirtualMachine 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.WithPlan, + DefinitionStages.WithIdentity, + DefinitionStages.WithZones, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithHardwareProfile, + DefinitionStages.WithStorageProfile, + DefinitionStages.WithAdditionalCapabilities, + DefinitionStages.WithOsProfile, + DefinitionStages.WithNetworkProfile, + DefinitionStages.WithSecurityProfile, + DefinitionStages.WithDiagnosticsProfile, + DefinitionStages.WithAvailabilitySet, + DefinitionStages.WithVirtualMachineScaleSet, + DefinitionStages.WithProximityPlacementGroup, + DefinitionStages.WithPriority, + DefinitionStages.WithEvictionPolicy, + DefinitionStages.WithBillingProfile, + DefinitionStages.WithHost, + DefinitionStages.WithHostGroup, + DefinitionStages.WithLicenseType, + DefinitionStages.WithExtensionsTimeBudget, + DefinitionStages.WithPlatformFaultDomain, + DefinitionStages.WithScheduledEventsProfile, + DefinitionStages.WithUserData, + DefinitionStages.WithCapacityReservation, + DefinitionStages.WithApplicationProfile { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachine create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachine create(Context context); + } + /** The stage of the VirtualMachine 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 VirtualMachine definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Specifies information about the marketplace image used to create the virtual + * machine. This element is only used for marketplace images. Before you can use a marketplace image from an + * API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that + * you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**.. + * + * @param plan Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you + * must enable the image for programmatic use. In the Azure portal, find the marketplace image that you + * want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the VirtualMachine definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the virtual machine, if configured.. + * + * @param identity The identity of the virtual machine, if configured. + * @return the next definition stage. + */ + WithCreate withIdentity(VirtualMachineIdentity identity); + } + /** The stage of the VirtualMachine definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: The virtual machine zones.. + * + * @param zones The virtual machine zones. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + /** The stage of the VirtualMachine definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location of the Virtual Machine.. + * + * @param extendedLocation The extended location of the Virtual Machine. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VirtualMachine definition allowing to specify hardwareProfile. */ + interface WithHardwareProfile { + /** + * Specifies the hardwareProfile property: Specifies the hardware settings for the virtual machine.. + * + * @param hardwareProfile Specifies the hardware settings for the virtual machine. + * @return the next definition stage. + */ + WithCreate withHardwareProfile(HardwareProfile hardwareProfile); + } + /** The stage of the VirtualMachine definition allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Specifies the storage settings for the virtual machine disks.. + * + * @param storageProfile Specifies the storage settings for the virtual machine disks. + * @return the next definition stage. + */ + WithCreate withStorageProfile(StorageProfile storageProfile); + } + /** The stage of the VirtualMachine definition allowing to specify additionalCapabilities. */ + interface WithAdditionalCapabilities { + /** + * Specifies the additionalCapabilities property: Specifies additional capabilities enabled or disabled on + * the virtual machine.. + * + * @param additionalCapabilities Specifies additional capabilities enabled or disabled on the virtual + * machine. + * @return the next definition stage. + */ + WithCreate withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities); + } + /** The stage of the VirtualMachine definition allowing to specify osProfile. */ + interface WithOsProfile { + /** + * Specifies the osProfile property: Specifies the operating system settings used while creating the virtual + * machine. Some of the settings cannot be changed once VM is provisioned.. + * + * @param osProfile Specifies the operating system settings used while creating the virtual machine. Some of + * the settings cannot be changed once VM is provisioned. + * @return the next definition stage. + */ + WithCreate withOsProfile(OSProfile osProfile); + } + /** The stage of the VirtualMachine definition allowing to specify networkProfile. */ + interface WithNetworkProfile { + /** + * Specifies the networkProfile property: Specifies the network interfaces of the virtual machine.. + * + * @param networkProfile Specifies the network interfaces of the virtual machine. + * @return the next definition stage. + */ + WithCreate withNetworkProfile(NetworkProfile networkProfile); + } + /** The stage of the VirtualMachine definition allowing to specify securityProfile. */ + interface WithSecurityProfile { + /** + * Specifies the securityProfile property: Specifies the Security related profile settings for the virtual + * machine.. + * + * @param securityProfile Specifies the Security related profile settings for the virtual machine. + * @return the next definition stage. + */ + WithCreate withSecurityProfile(SecurityProfile securityProfile); + } + /** The stage of the VirtualMachine definition allowing to specify diagnosticsProfile. */ + interface WithDiagnosticsProfile { + /** + * Specifies the diagnosticsProfile property: Specifies the boot diagnostic settings state. + * <br><br>Minimum api-version: 2015-06-15.. + * + * @param diagnosticsProfile Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * @return the next definition stage. + */ + WithCreate withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile); + } + /** The stage of the VirtualMachine definition allowing to specify availabilitySet. */ + interface WithAvailabilitySet { + /** + * Specifies the availabilitySet property: Specifies information about the availability set that the virtual + * machine should be assigned to. Virtual machines specified in the same availability set are allocated to + * different nodes to maximize availability. For more information about availability sets, see [Availability + * sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + * <br><br> For more information on Azure planned maintenance, see [Maintenance and updates for + * Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + * <br><br> Currently, a VM can only be added to availability set at creation time. The + * availability set to which the VM is being added should be under the same resource group as the + * availability set resource. An existing VM cannot be added to an availability set. + * <br><br>This property cannot exist along with a non-null properties.virtualMachineScaleSet + * reference.. + * + * @param availabilitySet Specifies information about the availability set that the virtual machine should + * be assigned to. Virtual machines specified in the same availability set are allocated to different + * nodes to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + * <br><br> For more information on Azure planned maintenance, see [Maintenance and updates + * for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + * <br><br> Currently, a VM can only be added to availability set at creation time. The + * availability set to which the VM is being added should be under the same resource group as the + * availability set resource. An existing VM cannot be added to an availability set. + * <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * @return the next definition stage. + */ + WithCreate withAvailabilitySet(SubResource availabilitySet); + } + /** The stage of the VirtualMachine definition allowing to specify virtualMachineScaleSet. */ + interface WithVirtualMachineScaleSet { + /** + * Specifies the virtualMachineScaleSet property: Specifies information about the virtual machine scale set + * that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine + * scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to + * virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale + * set. <br><br>This property cannot exist along with a non-null properties.availabilitySet + * reference. <br><br>Minimum api‐version: 2019‐03‐01. + * + * @param virtualMachineScaleSet Specifies information about the virtual machine scale set that the virtual + * machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual + * machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. + * <br><br>This property cannot exist along with a non-null properties.availabilitySet + * reference. <br><br>Minimum api‐version: 2019‐03‐01. + * @return the next definition stage. + */ + WithCreate withVirtualMachineScaleSet(SubResource virtualMachineScaleSet); + } + /** The stage of the VirtualMachine definition allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the virtual + * machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + WithCreate withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + /** The stage of the VirtualMachine definition allowing to specify priority. */ + interface WithPriority { + /** + * Specifies the priority property: Specifies the priority for the virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param priority Specifies the priority for the virtual machine. <br><br>Minimum api-version: + * 2019-03-01. + * @return the next definition stage. + */ + WithCreate withPriority(VirtualMachinePriorityTypes priority); + } + /** The stage of the VirtualMachine definition allowing to specify evictionPolicy. */ + interface WithEvictionPolicy { + /** + * Specifies the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine + * and Azure Spot scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot + * scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is + * 2017-10-30-preview.. + * + * @param evictionPolicy Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are + * supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, + * both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * @return the next definition stage. + */ + WithCreate withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy); + } + /** The stage of the VirtualMachine definition allowing to specify billingProfile. */ + interface WithBillingProfile { + /** + * Specifies the billingProfile property: Specifies the billing related details of a Azure Spot virtual + * machine. <br><br>Minimum api-version: 2019-03-01.. + * + * @param billingProfile Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * @return the next definition stage. + */ + WithCreate withBillingProfile(BillingProfile billingProfile); + } + /** The stage of the VirtualMachine definition allowing to specify host. */ + interface WithHost { + /** + * Specifies the host property: Specifies information about the dedicated host that the virtual machine + * resides in. <br><br>Minimum api-version: 2018-10-01.. + * + * @param host Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * @return the next definition stage. + */ + WithCreate withHost(SubResource host); + } + /** The stage of the VirtualMachine definition allowing to specify hostGroup. */ + interface WithHostGroup { + /** + * Specifies the hostGroup property: Specifies information about the dedicated host group that the virtual + * machine resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User + * cannot specify both host and hostGroup properties.. + * + * @param hostGroup Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot + * specify both host and hostGroup properties. + * @return the next definition stage. + */ + WithCreate withHostGroup(SubResource hostGroup); + } + /** The stage of the VirtualMachine definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies that the image or disk that is being used was licensed + * on-premises. <br><br> Possible values for Windows Server operating system are: + * <br><br> Windows_Client <br><br> Windows_Server <br><br> Possible + * values for Linux Server operating system are: <br><br> RHEL_BYOS (for RHEL) + * <br><br> SLES_BYOS (for SUSE) <br><br> For more information, see [Azure Hybrid + * Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * + * @param licenseType Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> + * Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux + * Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS + * (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * @return the next definition stage. + */ + WithCreate withLicenseType(String licenseType); + } + /** The stage of the VirtualMachine definition allowing to specify extensionsTimeBudget. */ + interface WithExtensionsTimeBudget { + /** + * Specifies the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The + * time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO + * 8601 format. The default value is 90 minutes (PT1H30M). <br><br> Minimum api-version: + * 2020-06-01. + * + * @param extensionsTimeBudget Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. + * The default value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * @return the next definition stage. + */ + WithCreate withExtensionsTimeBudget(String extensionsTimeBudget); + } + /** The stage of the VirtualMachine definition allowing to specify platformFaultDomain. */ + interface WithPlatformFaultDomain { + /** + * Specifies the platformFaultDomain property: Specifies the scale set logical fault domain into which the + * Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a + * fault domain that best maintains balance across available fault domains.<br><li>This is + * applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The + * Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' &gt; + * 1.<li>This property cannot be updated once the Virtual Machine is created.<li>Fault domain + * assignment can be viewed in the Virtual Machine Instance View.<br><br>Minimum api‐version: + * 2020‐12‐01. + * + * @param platformFaultDomain Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain + * that best maintains balance across available fault domains.<br><li>This is applicable + * only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual + * Machine Scale Set that is referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This + * property cannot be updated once the Virtual Machine is created.<li>Fault domain assignment can + * be viewed in the Virtual Machine Instance View.<br><br>Minimum api‐version: 2020‐12‐01. + * @return the next definition stage. + */ + WithCreate withPlatformFaultDomain(Integer platformFaultDomain); + } + /** The stage of the VirtualMachine definition allowing to specify scheduledEventsProfile. */ + interface WithScheduledEventsProfile { + /** + * Specifies the scheduledEventsProfile property: Specifies Scheduled Event related configurations.. + * + * @param scheduledEventsProfile Specifies Scheduled Event related configurations. + * @return the next definition stage. + */ + WithCreate withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile); + } + /** The stage of the VirtualMachine definition allowing to specify userData. */ + interface WithUserData { + /** + * Specifies the userData property: UserData for the VM, which must be base-64 encoded. Customer should not + * pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets + * in here. <br><br>Minimum api-version: 2021-03-01. + * @return the next definition stage. + */ + WithCreate withUserData(String userData); + } + /** The stage of the VirtualMachine definition allowing to specify capacityReservation. */ + interface WithCapacityReservation { + /** + * Specifies the capacityReservation property: Specifies information about the capacity reservation that is + * used to allocate virtual machine. <br><br>Minimum api-version: 2021-04-01.. + * + * @param capacityReservation Specifies information about the capacity reservation that is used to allocate + * virtual machine. <br><br>Minimum api-version: 2021-04-01. + * @return the next definition stage. + */ + WithCreate withCapacityReservation(CapacityReservationProfile capacityReservation); + } + /** The stage of the VirtualMachine definition allowing to specify applicationProfile. */ + interface WithApplicationProfile { + /** + * Specifies the applicationProfile property: Specifies the gallery applications that should be made + * available to the VM/VMSS. + * + * @param applicationProfile Specifies the gallery applications that should be made available to the + * VM/VMSS. + * @return the next definition stage. + */ + WithCreate withApplicationProfile(ApplicationProfile applicationProfile); + } + } + /** + * Begins update for the VirtualMachine resource. + * + * @return the stage of resource update. + */ + VirtualMachine.Update update(); + + /** The template for VirtualMachine update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithPlan, + UpdateStages.WithIdentity, + UpdateStages.WithZones, + UpdateStages.WithHardwareProfile, + UpdateStages.WithStorageProfile, + UpdateStages.WithAdditionalCapabilities, + UpdateStages.WithOsProfile, + UpdateStages.WithNetworkProfile, + UpdateStages.WithSecurityProfile, + UpdateStages.WithDiagnosticsProfile, + UpdateStages.WithAvailabilitySet, + UpdateStages.WithVirtualMachineScaleSet, + UpdateStages.WithProximityPlacementGroup, + UpdateStages.WithPriority, + UpdateStages.WithEvictionPolicy, + UpdateStages.WithBillingProfile, + UpdateStages.WithHost, + UpdateStages.WithHostGroup, + UpdateStages.WithLicenseType, + UpdateStages.WithExtensionsTimeBudget, + UpdateStages.WithPlatformFaultDomain, + UpdateStages.WithScheduledEventsProfile, + UpdateStages.WithUserData, + UpdateStages.WithCapacityReservation, + UpdateStages.WithApplicationProfile { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachine apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachine apply(Context context); + } + /** The VirtualMachine update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachine 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 VirtualMachine update allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Specifies information about the marketplace image used to create the virtual + * machine. This element is only used for marketplace images. Before you can use a marketplace image from an + * API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that + * you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**.. + * + * @param plan Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you + * must enable the image for programmatic use. In the Azure portal, find the marketplace image that you + * want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**. + * @return the next definition stage. + */ + Update withPlan(Plan plan); + } + /** The stage of the VirtualMachine update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the virtual machine, if configured.. + * + * @param identity The identity of the virtual machine, if configured. + * @return the next definition stage. + */ + Update withIdentity(VirtualMachineIdentity identity); + } + /** The stage of the VirtualMachine update allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: The virtual machine zones.. + * + * @param zones The virtual machine zones. + * @return the next definition stage. + */ + Update withZones(List zones); + } + /** The stage of the VirtualMachine update allowing to specify hardwareProfile. */ + interface WithHardwareProfile { + /** + * Specifies the hardwareProfile property: Specifies the hardware settings for the virtual machine.. + * + * @param hardwareProfile Specifies the hardware settings for the virtual machine. + * @return the next definition stage. + */ + Update withHardwareProfile(HardwareProfile hardwareProfile); + } + /** The stage of the VirtualMachine update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Specifies the storage settings for the virtual machine disks.. + * + * @param storageProfile Specifies the storage settings for the virtual machine disks. + * @return the next definition stage. + */ + Update withStorageProfile(StorageProfile storageProfile); + } + /** The stage of the VirtualMachine update allowing to specify additionalCapabilities. */ + interface WithAdditionalCapabilities { + /** + * Specifies the additionalCapabilities property: Specifies additional capabilities enabled or disabled on + * the virtual machine.. + * + * @param additionalCapabilities Specifies additional capabilities enabled or disabled on the virtual + * machine. + * @return the next definition stage. + */ + Update withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities); + } + /** The stage of the VirtualMachine update allowing to specify osProfile. */ + interface WithOsProfile { + /** + * Specifies the osProfile property: Specifies the operating system settings used while creating the virtual + * machine. Some of the settings cannot be changed once VM is provisioned.. + * + * @param osProfile Specifies the operating system settings used while creating the virtual machine. Some of + * the settings cannot be changed once VM is provisioned. + * @return the next definition stage. + */ + Update withOsProfile(OSProfile osProfile); + } + /** The stage of the VirtualMachine update allowing to specify networkProfile. */ + interface WithNetworkProfile { + /** + * Specifies the networkProfile property: Specifies the network interfaces of the virtual machine.. + * + * @param networkProfile Specifies the network interfaces of the virtual machine. + * @return the next definition stage. + */ + Update withNetworkProfile(NetworkProfile networkProfile); + } + /** The stage of the VirtualMachine update allowing to specify securityProfile. */ + interface WithSecurityProfile { + /** + * Specifies the securityProfile property: Specifies the Security related profile settings for the virtual + * machine.. + * + * @param securityProfile Specifies the Security related profile settings for the virtual machine. + * @return the next definition stage. + */ + Update withSecurityProfile(SecurityProfile securityProfile); + } + /** The stage of the VirtualMachine update allowing to specify diagnosticsProfile. */ + interface WithDiagnosticsProfile { + /** + * Specifies the diagnosticsProfile property: Specifies the boot diagnostic settings state. + * <br><br>Minimum api-version: 2015-06-15.. + * + * @param diagnosticsProfile Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * @return the next definition stage. + */ + Update withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile); + } + /** The stage of the VirtualMachine update allowing to specify availabilitySet. */ + interface WithAvailabilitySet { + /** + * Specifies the availabilitySet property: Specifies information about the availability set that the virtual + * machine should be assigned to. Virtual machines specified in the same availability set are allocated to + * different nodes to maximize availability. For more information about availability sets, see [Availability + * sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + * <br><br> For more information on Azure planned maintenance, see [Maintenance and updates for + * Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + * <br><br> Currently, a VM can only be added to availability set at creation time. The + * availability set to which the VM is being added should be under the same resource group as the + * availability set resource. An existing VM cannot be added to an availability set. + * <br><br>This property cannot exist along with a non-null properties.virtualMachineScaleSet + * reference.. + * + * @param availabilitySet Specifies information about the availability set that the virtual machine should + * be assigned to. Virtual machines specified in the same availability set are allocated to different + * nodes to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). + * <br><br> For more information on Azure planned maintenance, see [Maintenance and updates + * for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) + * <br><br> Currently, a VM can only be added to availability set at creation time. The + * availability set to which the VM is being added should be under the same resource group as the + * availability set resource. An existing VM cannot be added to an availability set. + * <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * @return the next definition stage. + */ + Update withAvailabilitySet(SubResource availabilitySet); + } + /** The stage of the VirtualMachine update allowing to specify virtualMachineScaleSet. */ + interface WithVirtualMachineScaleSet { + /** + * Specifies the virtualMachineScaleSet property: Specifies information about the virtual machine scale set + * that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine + * scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to + * virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale + * set. <br><br>This property cannot exist along with a non-null properties.availabilitySet + * reference. <br><br>Minimum api‐version: 2019‐03‐01. + * + * @param virtualMachineScaleSet Specifies information about the virtual machine scale set that the virtual + * machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual + * machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. + * <br><br>This property cannot exist along with a non-null properties.availabilitySet + * reference. <br><br>Minimum api‐version: 2019‐03‐01. + * @return the next definition stage. + */ + Update withVirtualMachineScaleSet(SubResource virtualMachineScaleSet); + } + /** The stage of the VirtualMachine update allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the virtual + * machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + Update withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + /** The stage of the VirtualMachine update allowing to specify priority. */ + interface WithPriority { + /** + * Specifies the priority property: Specifies the priority for the virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param priority Specifies the priority for the virtual machine. <br><br>Minimum api-version: + * 2019-03-01. + * @return the next definition stage. + */ + Update withPriority(VirtualMachinePriorityTypes priority); + } + /** The stage of the VirtualMachine update allowing to specify evictionPolicy. */ + interface WithEvictionPolicy { + /** + * Specifies the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine + * and Azure Spot scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot + * scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is + * 2017-10-30-preview.. + * + * @param evictionPolicy Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are + * supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, + * both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * @return the next definition stage. + */ + Update withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy); + } + /** The stage of the VirtualMachine update allowing to specify billingProfile. */ + interface WithBillingProfile { + /** + * Specifies the billingProfile property: Specifies the billing related details of a Azure Spot virtual + * machine. <br><br>Minimum api-version: 2019-03-01.. + * + * @param billingProfile Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * @return the next definition stage. + */ + Update withBillingProfile(BillingProfile billingProfile); + } + /** The stage of the VirtualMachine update allowing to specify host. */ + interface WithHost { + /** + * Specifies the host property: Specifies information about the dedicated host that the virtual machine + * resides in. <br><br>Minimum api-version: 2018-10-01.. + * + * @param host Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * @return the next definition stage. + */ + Update withHost(SubResource host); + } + /** The stage of the VirtualMachine update allowing to specify hostGroup. */ + interface WithHostGroup { + /** + * Specifies the hostGroup property: Specifies information about the dedicated host group that the virtual + * machine resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User + * cannot specify both host and hostGroup properties.. + * + * @param hostGroup Specifies information about the dedicated host group that the virtual machine resides + * in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot + * specify both host and hostGroup properties. + * @return the next definition stage. + */ + Update withHostGroup(SubResource hostGroup); + } + /** The stage of the VirtualMachine update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: Specifies that the image or disk that is being used was licensed + * on-premises. <br><br> Possible values for Windows Server operating system are: + * <br><br> Windows_Client <br><br> Windows_Server <br><br> Possible + * values for Linux Server operating system are: <br><br> RHEL_BYOS (for RHEL) + * <br><br> SLES_BYOS (for SUSE) <br><br> For more information, see [Azure Hybrid + * Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * + * @param licenseType Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> + * Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux + * Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS + * (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * @return the next definition stage. + */ + Update withLicenseType(String licenseType); + } + /** The stage of the VirtualMachine update allowing to specify extensionsTimeBudget. */ + interface WithExtensionsTimeBudget { + /** + * Specifies the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The + * time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO + * 8601 format. The default value is 90 minutes (PT1H30M). <br><br> Minimum api-version: + * 2020-06-01. + * + * @param extensionsTimeBudget Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. + * The default value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * @return the next definition stage. + */ + Update withExtensionsTimeBudget(String extensionsTimeBudget); + } + /** The stage of the VirtualMachine update allowing to specify platformFaultDomain. */ + interface WithPlatformFaultDomain { + /** + * Specifies the platformFaultDomain property: Specifies the scale set logical fault domain into which the + * Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a + * fault domain that best maintains balance across available fault domains.<br><li>This is + * applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The + * Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' &gt; + * 1.<li>This property cannot be updated once the Virtual Machine is created.<li>Fault domain + * assignment can be viewed in the Virtual Machine Instance View.<br><br>Minimum api‐version: + * 2020‐12‐01. + * + * @param platformFaultDomain Specifies the scale set logical fault domain into which the Virtual Machine + * will be created. By default, the Virtual Machine will by automatically assigned to a fault domain + * that best maintains balance across available fault domains.<br><li>This is applicable + * only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual + * Machine Scale Set that is referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This + * property cannot be updated once the Virtual Machine is created.<li>Fault domain assignment can + * be viewed in the Virtual Machine Instance View.<br><br>Minimum api‐version: 2020‐12‐01. + * @return the next definition stage. + */ + Update withPlatformFaultDomain(Integer platformFaultDomain); + } + /** The stage of the VirtualMachine update allowing to specify scheduledEventsProfile. */ + interface WithScheduledEventsProfile { + /** + * Specifies the scheduledEventsProfile property: Specifies Scheduled Event related configurations.. + * + * @param scheduledEventsProfile Specifies Scheduled Event related configurations. + * @return the next definition stage. + */ + Update withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile); + } + /** The stage of the VirtualMachine update allowing to specify userData. */ + interface WithUserData { + /** + * Specifies the userData property: UserData for the VM, which must be base-64 encoded. Customer should not + * pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets + * in here. <br><br>Minimum api-version: 2021-03-01. + * @return the next definition stage. + */ + Update withUserData(String userData); + } + /** The stage of the VirtualMachine update allowing to specify capacityReservation. */ + interface WithCapacityReservation { + /** + * Specifies the capacityReservation property: Specifies information about the capacity reservation that is + * used to allocate virtual machine. <br><br>Minimum api-version: 2021-04-01.. + * + * @param capacityReservation Specifies information about the capacity reservation that is used to allocate + * virtual machine. <br><br>Minimum api-version: 2021-04-01. + * @return the next definition stage. + */ + Update withCapacityReservation(CapacityReservationProfile capacityReservation); + } + /** The stage of the VirtualMachine update allowing to specify applicationProfile. */ + interface WithApplicationProfile { + /** + * Specifies the applicationProfile property: Specifies the gallery applications that should be made + * available to the VM/VMSS. + * + * @param applicationProfile Specifies the gallery applications that should be made available to the + * VM/VMSS. + * @return the next definition stage. + */ + Update withApplicationProfile(ApplicationProfile applicationProfile); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachine refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachine refresh(Context context); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + VirtualMachineCaptureResult capture(VirtualMachineCaptureParameters parameters); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + VirtualMachineCaptureResult capture(VirtualMachineCaptureParameters parameters, Context context); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToManagedDisks(); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToManagedDisks(Context context); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(Boolean hibernate); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(Boolean hibernate, Context context); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void generalize(); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response generalizeWithResponse(Context context); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(Boolean skipShutdown); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(Boolean skipShutdown, Context context); + + /** + * The operation to reapply a virtual machine's state. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reapply(); + + /** + * The operation to reapply a virtual machine's state. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reapply(Context context); + + /** + * The operation to restart a virtual machine. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * The operation to restart a virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); + + /** + * The operation to start a virtual machine. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * The operation to start a virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(Context context); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(VirtualMachineReimageParameters parameters); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(VirtualMachineReimageParameters parameters, Context context); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData(); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + Response retrieveBootDiagnosticsDataWithResponse( + Integer sasUriExpirationTimeInMinutes, Context context); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(Context context); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void simulateEviction(); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response simulateEvictionWithResponse(Context context); + + /** + * Assess patches on the VM. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + VirtualMachineAssessPatchesResult assessPatches(); + + /** + * Assess patches on the VM. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + VirtualMachineAssessPatchesResult assessPatches(Context context); + + /** + * Installs patches on the VM. + * + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + VirtualMachineInstallPatchesResult installPatches(VirtualMachineInstallPatchesParameters installPatchesInput); + + /** + * Installs patches on the VM. + * + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + VirtualMachineInstallPatchesResult installPatches( + VirtualMachineInstallPatchesParameters installPatchesInput, Context context); + + /** + * Run command on the VM. + * + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand(RunCommandInput parameters); + + /** + * Run command on the VM. + * + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand(RunCommandInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAgentInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAgentInstanceView.java new file mode 100644 index 0000000000000..76e015e162cd4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAgentInstanceView.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of the VM Agent running on the virtual machine. */ +@Fluent +public final class VirtualMachineAgentInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineAgentInstanceView.class); + + /* + * The VM Agent full version. + */ + @JsonProperty(value = "vmAgentVersion") + private String vmAgentVersion; + + /* + * The virtual machine extension handler instance view. + */ + @JsonProperty(value = "extensionHandlers") + private List extensionHandlers; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the vmAgentVersion property: The VM Agent full version. + * + * @return the vmAgentVersion value. + */ + public String vmAgentVersion() { + return this.vmAgentVersion; + } + + /** + * Set the vmAgentVersion property: The VM Agent full version. + * + * @param vmAgentVersion the vmAgentVersion value to set. + * @return the VirtualMachineAgentInstanceView object itself. + */ + public VirtualMachineAgentInstanceView withVmAgentVersion(String vmAgentVersion) { + this.vmAgentVersion = vmAgentVersion; + return this; + } + + /** + * Get the extensionHandlers property: The virtual machine extension handler instance view. + * + * @return the extensionHandlers value. + */ + public List extensionHandlers() { + return this.extensionHandlers; + } + + /** + * Set the extensionHandlers property: The virtual machine extension handler instance view. + * + * @param extensionHandlers the extensionHandlers value to set. + * @return the VirtualMachineAgentInstanceView object itself. + */ + public VirtualMachineAgentInstanceView withExtensionHandlers( + List extensionHandlers) { + this.extensionHandlers = extensionHandlers; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineAgentInstanceView object itself. + */ + public VirtualMachineAgentInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensionHandlers() != null) { + extensionHandlers().forEach(e -> e.validate()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAssessPatchesResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAssessPatchesResult.java new file mode 100644 index 0000000000000..5406f393b6385 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineAssessPatchesResult.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineAssessPatchesResult. */ +public interface VirtualMachineAssessPatchesResult { + /** + * Gets the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + PatchOperationStatus status(); + + /** + * Gets the assessmentActivityId property: The activity ID of the operation that produced this result. It is used to + * correlate across CRP and extension logs. + * + * @return the assessmentActivityId value. + */ + String assessmentActivityId(); + + /** + * Gets the rebootPending property: The overall reboot status of the VM. It will be true when partially installed + * patches require a reboot to complete installation but the reboot has not yet occurred. + * + * @return the rebootPending value. + */ + Boolean rebootPending(); + + /** + * Gets the criticalAndSecurityPatchCount property: The number of critical or security patches that have been + * detected as available and not yet installed. + * + * @return the criticalAndSecurityPatchCount value. + */ + Integer criticalAndSecurityPatchCount(); + + /** + * Gets the otherPatchCount property: The number of all available patches excluding critical and security. + * + * @return the otherPatchCount value. + */ + Integer otherPatchCount(); + + /** + * Gets the startDateTime property: The UTC timestamp when the operation began. + * + * @return the startDateTime value. + */ + OffsetDateTime startDateTime(); + + /** + * Gets the availablePatches property: The list of patches that have been detected as available for installation. + * + * @return the availablePatches value. + */ + List availablePatches(); + + /** + * Gets the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + ApiError error(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineAssessPatchesResultInner + * object. + * + * @return the inner object. + */ + VirtualMachineAssessPatchesResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureParameters.java new file mode 100644 index 0000000000000..e05d5d89ad3b6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureParameters.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Capture Virtual Machine parameters. */ +@Fluent +public final class VirtualMachineCaptureParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineCaptureParameters.class); + + /* + * The captured virtual hard disk's name prefix. + */ + @JsonProperty(value = "vhdPrefix", required = true) + private String vhdPrefix; + + /* + * The destination container name. + */ + @JsonProperty(value = "destinationContainerName", required = true) + private String destinationContainerName; + + /* + * Specifies whether to overwrite the destination virtual hard disk, in + * case of conflict. + */ + @JsonProperty(value = "overwriteVhds", required = true) + private boolean overwriteVhds; + + /** + * Get the vhdPrefix property: The captured virtual hard disk's name prefix. + * + * @return the vhdPrefix value. + */ + public String vhdPrefix() { + return this.vhdPrefix; + } + + /** + * Set the vhdPrefix property: The captured virtual hard disk's name prefix. + * + * @param vhdPrefix the vhdPrefix value to set. + * @return the VirtualMachineCaptureParameters object itself. + */ + public VirtualMachineCaptureParameters withVhdPrefix(String vhdPrefix) { + this.vhdPrefix = vhdPrefix; + return this; + } + + /** + * Get the destinationContainerName property: The destination container name. + * + * @return the destinationContainerName value. + */ + public String destinationContainerName() { + return this.destinationContainerName; + } + + /** + * Set the destinationContainerName property: The destination container name. + * + * @param destinationContainerName the destinationContainerName value to set. + * @return the VirtualMachineCaptureParameters object itself. + */ + public VirtualMachineCaptureParameters withDestinationContainerName(String destinationContainerName) { + this.destinationContainerName = destinationContainerName; + return this; + } + + /** + * Get the overwriteVhds property: Specifies whether to overwrite the destination virtual hard disk, in case of + * conflict. + * + * @return the overwriteVhds value. + */ + public boolean overwriteVhds() { + return this.overwriteVhds; + } + + /** + * Set the overwriteVhds property: Specifies whether to overwrite the destination virtual hard disk, in case of + * conflict. + * + * @param overwriteVhds the overwriteVhds value to set. + * @return the VirtualMachineCaptureParameters object itself. + */ + public VirtualMachineCaptureParameters withOverwriteVhds(boolean overwriteVhds) { + this.overwriteVhds = overwriteVhds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vhdPrefix() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property vhdPrefix in model VirtualMachineCaptureParameters")); + } + if (destinationContainerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationContainerName in model VirtualMachineCaptureParameters")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureResult.java new file mode 100644 index 0000000000000..a74c452ae2773 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineCaptureResult.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineCaptureResult. */ +public interface VirtualMachineCaptureResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the schema property: the schema of the captured virtual machine. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the contentVersion property: the version of the content. + * + * @return the contentVersion value. + */ + String contentVersion(); + + /** + * Gets the parameters property: parameters of the captured virtual machine. + * + * @return the parameters value. + */ + Object parameters(); + + /** + * Gets the resources property: a list of resource items of the captured virtual machine. + * + * @return the resources value. + */ + List resources(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineCaptureResultInner object. + * + * @return the inner object. + */ + VirtualMachineCaptureResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineEvictionPolicyTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineEvictionPolicyTypes.java new file mode 100644 index 0000000000000..e01520d9e69f0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineEvictionPolicyTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualMachineEvictionPolicyTypes. */ +public final class VirtualMachineEvictionPolicyTypes extends ExpandableStringEnum { + /** Static value Deallocate for VirtualMachineEvictionPolicyTypes. */ + public static final VirtualMachineEvictionPolicyTypes DEALLOCATE = fromString("Deallocate"); + + /** Static value Delete for VirtualMachineEvictionPolicyTypes. */ + public static final VirtualMachineEvictionPolicyTypes DELETE = fromString("Delete"); + + /** + * Creates or finds a VirtualMachineEvictionPolicyTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualMachineEvictionPolicyTypes. + */ + @JsonCreator + public static VirtualMachineEvictionPolicyTypes fromString(String name) { + return fromString(name, VirtualMachineEvictionPolicyTypes.class); + } + + /** @return known VirtualMachineEvictionPolicyTypes values. */ + public static Collection values() { + return values(VirtualMachineEvictionPolicyTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtension.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtension.java new file mode 100644 index 0000000000000..2a4563f10fabb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtension.java @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineExtension. */ +public interface VirtualMachineExtension { + /** + * 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 forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + String typeHandlerVersion(); + + /** + * Gets the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if + * one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + Boolean enableAutomaticUpgrade(); + + /** + * Gets the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + Object settings(); + + /** + * Gets the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + Object protectedSettings(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine extension instance view. + * + * @return the instanceView value. + */ + VirtualMachineExtensionInstanceView instanceView(); + + /** + * Gets the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + Boolean suppressFailures(); + + /** + * Gets the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + Object protectedSettingsFromKeyVault(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionInner object. + * + * @return the inner object. + */ + VirtualMachineExtensionInner innerModel(); + + /** The entirety of the VirtualMachineExtension definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The VirtualMachineExtension definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineExtension definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachineExtension definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the VirtualMachineExtension definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vmName. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be created or updated. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String vmName); + } + /** + * The stage of the VirtualMachineExtension 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.WithForceUpdateTag, + DefinitionStages.WithPublisher, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithTypeHandlerVersion, + DefinitionStages.WithAutoUpgradeMinorVersion, + DefinitionStages.WithEnableAutomaticUpgrade, + DefinitionStages.WithSettings, + DefinitionStages.WithProtectedSettings, + DefinitionStages.WithInstanceView, + DefinitionStages.WithSuppressFailures, + DefinitionStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineExtension create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineExtension create(Context context); + } + /** The stage of the VirtualMachineExtension 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 VirtualMachineExtension definition allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + WithCreate withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineExtension definition allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + WithCreate withPublisher(String publisher); + } + /** The stage of the VirtualMachineExtension definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(String typePropertiesType); + } + /** The stage of the VirtualMachineExtension definition allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + WithCreate withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the VirtualMachineExtension definition allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineExtension definition allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + WithCreate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineExtension definition allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + WithCreate withSettings(Object settings); + } + /** The stage of the VirtualMachineExtension definition allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + WithCreate withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineExtension definition allowing to specify instanceView. */ + interface WithInstanceView { + /** + * Specifies the instanceView property: The virtual machine extension instance view.. + * + * @param instanceView The virtual machine extension instance view. + * @return the next definition stage. + */ + WithCreate withInstanceView(VirtualMachineExtensionInstanceView instanceView); + } + /** The stage of the VirtualMachineExtension definition allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + WithCreate withSuppressFailures(Boolean suppressFailures); + } + /** The stage of the VirtualMachineExtension definition allowing to specify protectedSettingsFromKeyVault. */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + WithCreate withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Begins update for the VirtualMachineExtension resource. + * + * @return the stage of resource update. + */ + VirtualMachineExtension.Update update(); + + /** The template for VirtualMachineExtension update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithForceUpdateTag, + UpdateStages.WithPublisher, + UpdateStages.WithType, + UpdateStages.WithTypeHandlerVersion, + UpdateStages.WithAutoUpgradeMinorVersion, + UpdateStages.WithEnableAutomaticUpgrade, + UpdateStages.WithSettings, + UpdateStages.WithProtectedSettings, + UpdateStages.WithSuppressFailures, + UpdateStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineExtension apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineExtension apply(Context context); + } + /** The VirtualMachineExtension update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineExtension 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 VirtualMachineExtension update allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineExtension update allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + Update withPublisher(String publisher); + } + /** The stage of the VirtualMachineExtension update allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Specifies the type of the extension; an example is "CustomScriptExtension".. + * + * @param type Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + Update withType(String type); + } + /** The stage of the VirtualMachineExtension update allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + Update withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the VirtualMachineExtension update allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineExtension update allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + Update withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineExtension update allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + Update withSettings(Object settings); + } + /** The stage of the VirtualMachineExtension update allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + Update withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineExtension update allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + Update withSuppressFailures(Boolean suppressFailures); + } + /** The stage of the VirtualMachineExtension update allowing to specify protectedSettingsFromKeyVault. */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + Update withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachineExtension refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineExtension refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionHandlerInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionHandlerInstanceView.java new file mode 100644 index 0000000000000..f77fd0bed1c41 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionHandlerInstanceView.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The instance view of a virtual machine extension handler. */ +@Fluent +public final class VirtualMachineExtensionHandlerInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionHandlerInstanceView.class); + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * The extension handler status. + */ + @JsonProperty(value = "status") + private InstanceViewStatus status; + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionHandlerInstanceView object itself. + */ + public VirtualMachineExtensionHandlerInstanceView withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionHandlerInstanceView object itself. + */ + public VirtualMachineExtensionHandlerInstanceView withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the status property: The extension handler status. + * + * @return the status value. + */ + public InstanceViewStatus status() { + return this.status; + } + + /** + * Set the status property: The extension handler status. + * + * @param status the status value to set. + * @return the VirtualMachineExtensionHandlerInstanceView object itself. + */ + public VirtualMachineExtensionHandlerInstanceView withStatus(InstanceViewStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImage.java new file mode 100644 index 0000000000000..8f2166797dd98 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImage.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionImageInner; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineExtensionImage. */ +public interface VirtualMachineExtensionImage { + /** + * 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 operatingSystem property: The operating system this extension supports. + * + * @return the operatingSystem value. + */ + String operatingSystem(); + + /** + * Gets the computeRole property: The type of role (IaaS or PaaS) this extension supports. + * + * @return the computeRole value. + */ + String computeRole(); + + /** + * Gets the handlerSchema property: The schema defined by publisher, where extension consumers should provide + * settings in a matching schema. + * + * @return the handlerSchema value. + */ + String handlerSchema(); + + /** + * Gets the vmScaleSetEnabled property: Whether the extension can be used on xRP VMScaleSets. By default existing + * extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the + * extension is only enabled for CRP VMs but not VMSS. + * + * @return the vmScaleSetEnabled value. + */ + Boolean vmScaleSetEnabled(); + + /** + * Gets the supportsMultipleExtensions property: Whether the handler can support multiple extensions. + * + * @return the supportsMultipleExtensions value. + */ + Boolean supportsMultipleExtensions(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionImageInner + * object. + * + * @return the inner object. + */ + VirtualMachineExtensionImageInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImages.java new file mode 100644 index 0000000000000..6544312b47c39 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionImages.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of VirtualMachineExtensionImages. */ +public interface VirtualMachineExtensionImages { + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 extension image. + */ + VirtualMachineExtensionImage get(String location, String publisherName, String type, String version); + + /** + * Gets a virtual machine extension image. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param version The version parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 extension image along with {@link Response}. + */ + Response getWithResponse( + String location, String publisherName, String type, String version, Context context); + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types. + */ + List listTypes(String location, String publisherName); + + /** + * Gets a list of virtual machine extension image types. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image types along with {@link Response}. + */ + Response> listTypesWithResponse( + String location, String publisherName, Context context); + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions. + */ + List listVersions(String location, String publisherName, String type); + + /** + * Gets a list of virtual machine extension image versions. + * + * @param location The name of a supported Azure region. + * @param publisherName The publisherName parameter. + * @param type The type parameter. + * @param filter The filter to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine extension image versions along with {@link Response}. + */ + Response> listVersionsWithResponse( + String location, + String publisherName, + String type, + String filter, + Integer top, + String orderby, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionInstanceView.java new file mode 100644 index 0000000000000..b7868c1f49ae6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionInstanceView.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance view of a virtual machine extension. */ +@Fluent +public final class VirtualMachineExtensionInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionInstanceView.class); + + /* + * The virtual machine extension name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * The resource status information. + */ + @JsonProperty(value = "substatuses") + private List substatuses; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the name property: The virtual machine extension name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The virtual machine extension name. + * + * @param name the name value to set. + * @return the VirtualMachineExtensionInstanceView object itself. + */ + public VirtualMachineExtensionInstanceView withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionInstanceView object itself. + */ + public VirtualMachineExtensionInstanceView withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionInstanceView object itself. + */ + public VirtualMachineExtensionInstanceView withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the substatuses property: The resource status information. + * + * @return the substatuses value. + */ + public List substatuses() { + return this.substatuses; + } + + /** + * Set the substatuses property: The resource status information. + * + * @param substatuses the substatuses value to set. + * @return the VirtualMachineExtensionInstanceView object itself. + */ + public VirtualMachineExtensionInstanceView withSubstatuses(List substatuses) { + this.substatuses = substatuses; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineExtensionInstanceView object itself. + */ + public VirtualMachineExtensionInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (substatuses() != null) { + substatuses().forEach(e -> e.validate()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionUpdate.java new file mode 100644 index 0000000000000..e83ad9e3e6681 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionUpdate.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Virtual Machine Extension. */ +@Fluent +public final class VirtualMachineExtensionUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionUpdate.class); + + /* + * Describes the properties of a Virtual Machine Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineExtensionUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineExtensionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineExtensionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineExtensionUpdate object itself. + */ + public VirtualMachineExtensionUpdate withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensions.java new file mode 100644 index 0000000000000..2605ba9140f1c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensions.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachineExtensions. */ +public interface VirtualMachineExtensions { + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String vmExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be deleted. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String vmExtensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension. + */ + VirtualMachineExtension get(String resourceGroupName, String vmName, String vmExtensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context); + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response. + */ + VirtualMachineExtensionsListResult list(String resourceGroupName, String vmName); + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Extension operation response along with {@link Response}. + */ + Response listWithResponse( + String resourceGroupName, String vmName, String expand, Context context); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response}. + */ + VirtualMachineExtension getById(String id); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Extension along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * The operation to delete the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the extension. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 VirtualMachineExtension resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineExtension definition. + */ + VirtualMachineExtension.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionsListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionsListResult.java new file mode 100644 index 0000000000000..578d162d718a0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineExtensionsListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineExtensionsListResult. */ +public interface VirtualMachineExtensionsListResult { + /** + * Gets the value property: The list of extensions. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionsListResultInner + * object. + * + * @return the inner object. + */ + VirtualMachineExtensionsListResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineHealthStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineHealthStatus.java new file mode 100644 index 0000000000000..a47cb628725b6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineHealthStatus.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The health status of the VM. */ +@Immutable +public final class VirtualMachineHealthStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineHealthStatus.class); + + /* + * The health status information for the VM. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private InstanceViewStatus status; + + /** + * Get the status property: The health status information for the VM. + * + * @return the status value. + */ + public InstanceViewStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIdentity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIdentity.java new file mode 100644 index 0000000000000..324c53f875b47 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIdentity.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the virtual machine. */ +@Fluent +public class VirtualMachineIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineIdentity.class); + + /* + * The principal id of virtual machine identity. This property will only be + * provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id associated with the virtual machine. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the virtual machine. The type + * 'SystemAssigned, UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the virtual machine. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the Virtual Machine. The + * user identity dictionary key references will be ARM resource ids in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal id of virtual machine 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 associated with the virtual machine. 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 identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the virtual machine. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the virtual machine. + * + * @param type the type value to set. + * @return the VirtualMachineIdentity object itself. + */ + public VirtualMachineIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the Virtual Machine. The + * user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the Virtual Machine. The + * user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the VirtualMachineIdentity object itself. + */ + public VirtualMachineIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImage.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImage.java new file mode 100644 index 0000000000000..bbf8f58063763 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImage.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineImage. */ +public interface VirtualMachineImage { + /** + * 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 location property: The supported Azure location of the resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Specifies the tags that are assigned to the virtual machine. For more information about + * using tags, see [Using tags to organize your Azure + * resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: The extended location of the Virtual Machine. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the plan property: Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + * + * @return the plan value. + */ + PurchasePlan plan(); + + /** + * Gets the osDiskImage property: Contains the os disk image information. + * + * @return the osDiskImage value. + */ + OSDiskImage osDiskImage(); + + /** + * Gets the dataDiskImages property: The dataDiskImages property. + * + * @return the dataDiskImages value. + */ + List dataDiskImages(); + + /** + * Gets the automaticOSUpgradeProperties property: Describes automatic OS upgrade properties on the image. + * + * @return the automaticOSUpgradeProperties value. + */ + AutomaticOSUpgradeProperties automaticOSUpgradeProperties(); + + /** + * Gets the hyperVGeneration property: Specifies the HyperVGeneration Type. + * + * @return the hyperVGeneration value. + */ + HyperVGenerationTypes hyperVGeneration(); + + /** + * Gets the disallowed property: Specifies disallowed configuration for the VirtualMachine created from the image. + * + * @return the disallowed value. + */ + DisallowedConfiguration disallowed(); + + /** + * Gets the features property: The features property. + * + * @return the features value. + */ + List features(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageInner object. + * + * @return the inner object. + */ + VirtualMachineImageInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageFeature.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageFeature.java new file mode 100644 index 0000000000000..533fd0504d8cc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageFeature.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies additional capabilities supported by the image. */ +@Fluent +public final class VirtualMachineImageFeature { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImageFeature.class); + + /* + * The name of the feature. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The corresponding value for the feature. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the feature. + * + * @param name the name value to set. + * @return the VirtualMachineImageFeature object itself. + */ + public VirtualMachineImageFeature withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The corresponding value for the feature. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The corresponding value for the feature. + * + * @param value the value value to set. + * @return the VirtualMachineImageFeature object itself. + */ + public VirtualMachineImageFeature withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageResource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageResource.java new file mode 100644 index 0000000000000..0c110c36a3d2f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImageResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineImageResource. */ +public interface VirtualMachineImageResource { + /** + * 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 location property: The supported Azure location of the resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Specifies the tags that are assigned to the virtual machine. For more information about + * using tags, see [Using tags to organize your Azure + * resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: The extended location of the Virtual Machine. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineImageResourceInner object. + * + * @return the inner object. + */ + VirtualMachineImageResourceInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImages.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImages.java new file mode 100644 index 0000000000000..6d7f59f0cdfcb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImages.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of VirtualMachineImages. */ +public interface VirtualMachineImages { + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image. + */ + VirtualMachineImage get(String location, String publisherName, String offer, String skus, String version); + + /** + * Gets a virtual machine image. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image along with {@link Response}. + */ + Response getWithResponse( + String location, String publisherName, String offer, String skus, String version, Context context); + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + */ + List list(String location, String publisherName, String offer, String skus); + + /** + * Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top The top parameter. + * @param orderby The orderby parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, publisher, offer, and SKU along + * with {@link Response}. + */ + Response> listWithResponse( + String location, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context); + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher. + */ + List listOffers(String location, String publisherName); + + /** + * Gets a list of virtual machine image offers for the specified location and publisher. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location and publisher along with {@link + * Response}. + */ + Response> listOffersWithResponse( + String location, String publisherName, Context context); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location. + */ + List listPublishers(String location); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location. + * + * @param location The name of a supported Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location along with {@link Response}. + */ + Response> listPublishersWithResponse(String location, Context context); + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer. + */ + List listSkus(String location, String publisherName, String offer); + + /** + * Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, publisher, and offer along with {@link + * Response}. + */ + Response> listSkusWithResponse( + String location, String publisherName, String offer, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImagesEdgeZones.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImagesEdgeZones.java new file mode 100644 index 0000000000000..91aac95a217a6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineImagesEdgeZones.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of VirtualMachineImagesEdgeZones. */ +public interface VirtualMachineImagesEdgeZones { + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image in an edge zone. + */ + VirtualMachineImage get( + String location, String edgeZone, String publisherName, String offer, String skus, String version); + + /** + * Gets a virtual machine image in an edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param version A valid image SKU version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 image in an edge zone along with {@link Response}. + */ + Response getWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String version, + Context context); + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + */ + List list( + String location, String edgeZone, String publisherName, String offer, String skus); + + /** + * Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param skus A valid image SKU. + * @param expand The expand expression to apply on the operation. + * @param top An integer value specifying the number of images to return that matches supplied values. + * @param orderby Specifies the order of the results returned. Formatted as an OData query. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and + * SKU along with {@link Response}. + */ + Response> listWithResponse( + String location, + String edgeZone, + String publisherName, + String offer, + String skus, + String expand, + Integer top, + String orderby, + Context context); + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher. + */ + List listOffers(String location, String edgeZone, String publisherName); + + /** + * Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image offers for the specified location, edge zone and publisher along with + * {@link Response}. + */ + Response> listOffersWithResponse( + String location, String edgeZone, String publisherName, Context context); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone. + */ + List listPublishers(String location, String edgeZone); + + /** + * Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image publishers for the specified Azure location and edge zone along with + * {@link Response}. + */ + Response> listPublishersWithResponse( + String location, String edgeZone, Context context); + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + */ + List listSkus(String location, String edgeZone, String publisherName, String offer); + + /** + * Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + * + * @param location The name of a supported Azure region. + * @param edgeZone The name of the edge zone. + * @param publisherName A valid image publisher. + * @param offer A valid image publisher offer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer along + * with {@link Response}. + */ + Response> listSkusWithResponse( + String location, String edgeZone, String publisherName, String offer, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesParameters.java new file mode 100644 index 0000000000000..3a982462aa172 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesParameters.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Input for InstallPatches as directly received by the API. */ +@Fluent +public final class VirtualMachineInstallPatchesParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineInstallPatchesParameters.class); + + /* + * Specifies the maximum amount of time that the operation will run. It + * must be an ISO 8601-compliant duration string such as PT4H (4 hours) + */ + @JsonProperty(value = "maximumDuration") + private String maximumDuration; + + /* + * Defines when it is acceptable to reboot a VM during a software update + * operation. + */ + @JsonProperty(value = "rebootSetting", required = true) + private VMGuestPatchRebootSetting rebootSetting; + + /* + * Input for InstallPatches on a Windows VM, as directly received by the + * API + */ + @JsonProperty(value = "windowsParameters") + private WindowsParameters windowsParameters; + + /* + * Input for InstallPatches on a Linux VM, as directly received by the API + */ + @JsonProperty(value = "linuxParameters") + private LinuxParameters linuxParameters; + + /** + * Get the maximumDuration property: Specifies the maximum amount of time that the operation will run. It must be an + * ISO 8601-compliant duration string such as PT4H (4 hours). + * + * @return the maximumDuration value. + */ + public String maximumDuration() { + return this.maximumDuration; + } + + /** + * Set the maximumDuration property: Specifies the maximum amount of time that the operation will run. It must be an + * ISO 8601-compliant duration string such as PT4H (4 hours). + * + * @param maximumDuration the maximumDuration value to set. + * @return the VirtualMachineInstallPatchesParameters object itself. + */ + public VirtualMachineInstallPatchesParameters withMaximumDuration(String maximumDuration) { + this.maximumDuration = maximumDuration; + return this; + } + + /** + * Get the rebootSetting property: Defines when it is acceptable to reboot a VM during a software update operation. + * + * @return the rebootSetting value. + */ + public VMGuestPatchRebootSetting rebootSetting() { + return this.rebootSetting; + } + + /** + * Set the rebootSetting property: Defines when it is acceptable to reboot a VM during a software update operation. + * + * @param rebootSetting the rebootSetting value to set. + * @return the VirtualMachineInstallPatchesParameters object itself. + */ + public VirtualMachineInstallPatchesParameters withRebootSetting(VMGuestPatchRebootSetting rebootSetting) { + this.rebootSetting = rebootSetting; + return this; + } + + /** + * Get the windowsParameters property: Input for InstallPatches on a Windows VM, as directly received by the API. + * + * @return the windowsParameters value. + */ + public WindowsParameters windowsParameters() { + return this.windowsParameters; + } + + /** + * Set the windowsParameters property: Input for InstallPatches on a Windows VM, as directly received by the API. + * + * @param windowsParameters the windowsParameters value to set. + * @return the VirtualMachineInstallPatchesParameters object itself. + */ + public VirtualMachineInstallPatchesParameters withWindowsParameters(WindowsParameters windowsParameters) { + this.windowsParameters = windowsParameters; + return this; + } + + /** + * Get the linuxParameters property: Input for InstallPatches on a Linux VM, as directly received by the API. + * + * @return the linuxParameters value. + */ + public LinuxParameters linuxParameters() { + return this.linuxParameters; + } + + /** + * Set the linuxParameters property: Input for InstallPatches on a Linux VM, as directly received by the API. + * + * @param linuxParameters the linuxParameters value to set. + * @return the VirtualMachineInstallPatchesParameters object itself. + */ + public VirtualMachineInstallPatchesParameters withLinuxParameters(LinuxParameters linuxParameters) { + this.linuxParameters = linuxParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rebootSetting() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rebootSetting in model VirtualMachineInstallPatchesParameters")); + } + if (windowsParameters() != null) { + windowsParameters().validate(); + } + if (linuxParameters() != null) { + linuxParameters().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesResult.java new file mode 100644 index 0000000000000..b29af4356f73a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstallPatchesResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineInstallPatchesResult. */ +public interface VirtualMachineInstallPatchesResult { + /** + * Gets the status property: The overall success or failure status of the operation. It remains "InProgress" until + * the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + * "CompletedWithWarnings.". + * + * @return the status value. + */ + PatchOperationStatus status(); + + /** + * Gets the installationActivityId property: The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + * + * @return the installationActivityId value. + */ + String installationActivityId(); + + /** + * Gets the rebootStatus property: The reboot state of the VM following completion of the operation. + * + * @return the rebootStatus value. + */ + VMGuestPatchRebootStatus rebootStatus(); + + /** + * Gets the maintenanceWindowExceeded property: Whether the operation ran out of time before it completed all its + * intended actions. + * + * @return the maintenanceWindowExceeded value. + */ + Boolean maintenanceWindowExceeded(); + + /** + * Gets the excludedPatchCount property: The number of patches that were not installed due to the user blocking + * their installation. + * + * @return the excludedPatchCount value. + */ + Integer excludedPatchCount(); + + /** + * Gets the notSelectedPatchCount property: The number of patches that were detected as available for install, but + * did not meet the operation's criteria. + * + * @return the notSelectedPatchCount value. + */ + Integer notSelectedPatchCount(); + + /** + * Gets the pendingPatchCount property: The number of patches that were identified as meeting the installation + * criteria, but were not able to be installed. Typically this happens when maintenanceWindowExceeded == true. + * + * @return the pendingPatchCount value. + */ + Integer pendingPatchCount(); + + /** + * Gets the installedPatchCount property: The number of patches successfully installed. + * + * @return the installedPatchCount value. + */ + Integer installedPatchCount(); + + /** + * Gets the failedPatchCount property: The number of patches that could not be installed due to some issue. See + * errors for details. + * + * @return the failedPatchCount value. + */ + Integer failedPatchCount(); + + /** + * Gets the patches property: The patches that were installed during the operation. + * + * @return the patches value. + */ + List patches(); + + /** + * Gets the startDateTime property: The UTC timestamp when the operation began. + * + * @return the startDateTime value. + */ + OffsetDateTime startDateTime(); + + /** + * Gets the error property: The errors that were encountered during execution of the operation. The details array + * contains the list of them. + * + * @return the error value. + */ + ApiError error(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstallPatchesResultInner + * object. + * + * @return the inner object. + */ + VirtualMachineInstallPatchesResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstanceView.java new file mode 100644 index 0000000000000..0bfc42e87ca17 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineInstanceView.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineInstanceView. */ +public interface VirtualMachineInstanceView { + /** + * Gets the platformUpdateDomain property: Specifies the update domain of the virtual machine. + * + * @return the platformUpdateDomain value. + */ + Integer platformUpdateDomain(); + + /** + * Gets the platformFaultDomain property: Specifies the fault domain of the virtual machine. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the computerName property: The computer name assigned to the virtual machine. + * + * @return the computerName value. + */ + String computerName(); + + /** + * Gets the osName property: The Operating System running on the virtual machine. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the osVersion property: The version of Operating System running on the virtual machine. + * + * @return the osVersion value. + */ + String osVersion(); + + /** + * Gets the hyperVGeneration property: Specifies the HyperVGeneration Type associated with a resource. + * + * @return the hyperVGeneration value. + */ + HyperVGenerationType hyperVGeneration(); + + /** + * Gets the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @return the rdpThumbPrint value. + */ + String rdpThumbPrint(); + + /** + * Gets the vmAgent property: The VM Agent running on the virtual machine. + * + * @return the vmAgent value. + */ + VirtualMachineAgentInstanceView vmAgent(); + + /** + * Gets the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @return the maintenanceRedeployStatus value. + */ + MaintenanceRedeployStatus maintenanceRedeployStatus(); + + /** + * Gets the disks property: The virtual machine disk information. + * + * @return the disks value. + */ + List disks(); + + /** + * Gets the extensions property: The extensions information. + * + * @return the extensions value. + */ + List extensions(); + + /** + * Gets the vmHealth property: The health status for the VM. + * + * @return the vmHealth value. + */ + VirtualMachineHealthStatus vmHealth(); + + /** + * Gets the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console + * Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console + * log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @return the bootDiagnostics value. + */ + BootDiagnosticsInstanceView bootDiagnostics(); + + /** + * Gets the assignedHost property: Resource id of the dedicated host, on which the virtual machine is allocated + * through automatic placement, when the virtual machine is associated with a dedicated host group that has + * automatic placement enabled. <br><br>Minimum api-version: 2020-06-01. + * + * @return the assignedHost value. + */ + String assignedHost(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the patchStatus property: [Preview Feature] The status of virtual machine patch operations. + * + * @return the patchStatus value. + */ + VirtualMachinePatchStatus patchStatus(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInstanceViewInner object. + * + * @return the inner object. + */ + VirtualMachineInstanceViewInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIpTag.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIpTag.java new file mode 100644 index 0000000000000..4252c6f084953 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineIpTag.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the IP tag associated with the public IP address. */ +@Fluent +public final class VirtualMachineIpTag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineIpTag.class); + + /* + * IP tag type. Example: FirstPartyUsage. + */ + @JsonProperty(value = "ipTagType") + private String ipTagType; + + /* + * IP tag associated with the public IP. Example: SQL, Storage etc. + */ + @JsonProperty(value = "tag") + private String tag; + + /** + * Get the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @return the ipTagType value. + */ + public String ipTagType() { + return this.ipTagType; + } + + /** + * Set the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @param ipTagType the ipTagType value to set. + * @return the VirtualMachineIpTag object itself. + */ + public VirtualMachineIpTag withIpTagType(String ipTagType) { + this.ipTagType = ipTagType; + return this; + } + + /** + * Get the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Set the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @param tag the tag value to set. + * @return the VirtualMachineIpTag object itself. + */ + public VirtualMachineIpTag withTag(String tag) { + this.tag = tag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineListResult.java new file mode 100644 index 0000000000000..6558fe4293311 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine operation response. */ +@Fluent +public final class VirtualMachineListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineListResult.class); + + /* + * The list of virtual machines. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of VMs. Call ListNext() with this URI to + * fetch the next page of Virtual Machines. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of virtual machines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machines. + * + * @param value the value value to set. + * @return the VirtualMachineListResult object itself. + */ + public VirtualMachineListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next + * page of Virtual Machines. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next + * page of Virtual Machines. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineListResult object itself. + */ + public VirtualMachineListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model VirtualMachineListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceConfiguration.java new file mode 100644 index 0000000000000..e9b91d5269a84 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceConfiguration.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineNetworkInterfaceConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine network interface configurations. */ +@Fluent +public final class VirtualMachineNetworkInterfaceConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineNetworkInterfaceConfiguration.class); + + /* + * The network interface configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machine network profile's IP configuration. + */ + @JsonProperty(value = "properties") + private VirtualMachineNetworkInterfaceConfigurationProperties innerProperties; + + /** + * Get the name property: The network interface configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The network interface configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine network profile's IP configuration. + * + * @return the innerProperties value. + */ + private VirtualMachineNetworkInterfaceConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.innerProperties() == null ? null : this.innerProperties().enableAcceleratedNetworking(); + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withEnableAcceleratedNetworking(enableAcceleratedNetworking); + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.innerProperties() == null ? null : this.innerProperties().enableFpga(); + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withEnableFpga(Boolean enableFpga) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withEnableFpga(enableFpga); + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.innerProperties() == null ? null : this.innerProperties().enableIpForwarding(); + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withEnableIpForwarding(Boolean enableIpForwarding) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withEnableIpForwarding(enableIpForwarding); + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.innerProperties() == null ? null : this.innerProperties().networkSecurityGroup(); + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withNetworkSecurityGroup(SubResource networkSecurityGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withNetworkSecurityGroup(networkSecurityGroup); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withDnsSettings( + VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.innerProperties() == null ? null : this.innerProperties().ipConfigurations(); + } + + /** + * Set the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withIpConfigurations( + List ipConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withIpConfigurations(ipConfigurations); + return this; + } + + /** + * Get the dscpConfiguration property: The dscpConfiguration property. + * + * @return the dscpConfiguration value. + */ + public SubResource dscpConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().dscpConfiguration(); + } + + /** + * Set the dscpConfiguration property: The dscpConfiguration property. + * + * @param dscpConfiguration the dscpConfiguration value to set. + * @return the VirtualMachineNetworkInterfaceConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceConfiguration withDscpConfiguration(SubResource dscpConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceConfigurationProperties(); + } + this.innerProperties().withDscpConfiguration(dscpConfiguration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineNetworkInterfaceConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.java new file mode 100644 index 0000000000000..d6ebe8ba17c05 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines network configuration's DNS settings. */ +@Fluent +public final class VirtualMachineNetworkInterfaceDnsSettingsConfiguration { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineNetworkInterfaceDnsSettingsConfiguration.class); + + /* + * List of DNS servers IP addresses + */ + @JsonProperty(value = "dnsServers") + private List dnsServers; + + /** + * Get the dnsServers property: List of DNS servers IP addresses. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: List of DNS servers IP addresses. + * + * @param dnsServers the dnsServers value to set. + * @return the VirtualMachineNetworkInterfaceDnsSettingsConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceDnsSettingsConfiguration withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceIpConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceIpConfiguration.java new file mode 100644 index 0000000000000..1974cceec5393 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineNetworkInterfaceIpConfiguration.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineNetworkInterfaceIpConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine network profile's IP configuration. */ +@Fluent +public final class VirtualMachineNetworkInterfaceIpConfiguration { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineNetworkInterfaceIpConfiguration.class); + + /* + * The IP configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machine network interface IP configuration + * properties. + */ + @JsonProperty(value = "properties") + private VirtualMachineNetworkInterfaceIpConfigurationProperties innerProperties; + + /** + * Get the name property: The IP configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The IP configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine network interface IP configuration properties. + * + * @return the innerProperties value. + */ + private VirtualMachineNetworkInterfaceIpConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subnet property: Specifies the identifier of the subnet. + * + * @return the subnet value. + */ + public SubResource subnet() { + return this.innerProperties() == null ? null : this.innerProperties().subnet(); + } + + /** + * Set the subnet property: Specifies the identifier of the subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withSubnet(SubResource subnet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withSubnet(subnet); + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachinePublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressConfiguration(); + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withPublicIpAddressConfiguration( + VirtualMachinePublicIpAddressConfiguration publicIpAddressConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withPublicIpAddressConfiguration(publicIpAddressConfiguration); + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersions privateIpAddressVersion() { + return this.innerProperties() == null ? null : this.innerProperties().privateIpAddressVersion(); + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withPrivateIpAddressVersion( + IpVersions privateIpAddressVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withPrivateIpAddressVersion(privateIpAddressVersion); + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.innerProperties() == null ? null : this.innerProperties().applicationSecurityGroups(); + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withApplicationSecurityGroups( + List applicationSecurityGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withApplicationSecurityGroups(applicationSecurityGroups); + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A virtual machine can reference backend address pools of multiple application gateways. + * Multiple virtual machines cannot use the same application gateway. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().applicationGatewayBackendAddressPools(); + } + + /** + * Set the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A virtual machine can reference backend address pools of multiple application gateways. + * Multiple virtual machines cannot use the same application gateway. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withApplicationGatewayBackendAddressPools(applicationGatewayBackendAddressPools); + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A virtual machine can reference backend address pools of one public and one internal load + * balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerBackendAddressPools(); + } + + /** + * Set the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A virtual machine can reference backend address pools of one public and one internal load + * balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineNetworkInterfaceIpConfiguration object itself. + */ + public VirtualMachineNetworkInterfaceIpConfiguration withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineNetworkInterfaceIpConfigurationProperties(); + } + this.innerProperties().withLoadBalancerBackendAddressPools(loadBalancerBackendAddressPools); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineNetworkInterfaceIpConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePatchStatus.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePatchStatus.java new file mode 100644 index 0000000000000..79702ae297d59 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePatchStatus.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The status of virtual machine patch operations. */ +@Fluent +public final class VirtualMachinePatchStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachinePatchStatus.class); + + /* + * The available patch summary of the latest assessment operation for the + * virtual machine. + */ + @JsonProperty(value = "availablePatchSummary") + private AvailablePatchSummary availablePatchSummary; + + /* + * The installation summary of the latest installation operation for the + * virtual machine. + */ + @JsonProperty(value = "lastPatchInstallationSummary") + private LastPatchInstallationSummary lastPatchInstallationSummary; + + /* + * The enablement status of the specified patchMode + */ + @JsonProperty(value = "configurationStatuses", access = JsonProperty.Access.WRITE_ONLY) + private List configurationStatuses; + + /** + * Get the availablePatchSummary property: The available patch summary of the latest assessment operation for the + * virtual machine. + * + * @return the availablePatchSummary value. + */ + public AvailablePatchSummary availablePatchSummary() { + return this.availablePatchSummary; + } + + /** + * Set the availablePatchSummary property: The available patch summary of the latest assessment operation for the + * virtual machine. + * + * @param availablePatchSummary the availablePatchSummary value to set. + * @return the VirtualMachinePatchStatus object itself. + */ + public VirtualMachinePatchStatus withAvailablePatchSummary(AvailablePatchSummary availablePatchSummary) { + this.availablePatchSummary = availablePatchSummary; + return this; + } + + /** + * Get the lastPatchInstallationSummary property: The installation summary of the latest installation operation for + * the virtual machine. + * + * @return the lastPatchInstallationSummary value. + */ + public LastPatchInstallationSummary lastPatchInstallationSummary() { + return this.lastPatchInstallationSummary; + } + + /** + * Set the lastPatchInstallationSummary property: The installation summary of the latest installation operation for + * the virtual machine. + * + * @param lastPatchInstallationSummary the lastPatchInstallationSummary value to set. + * @return the VirtualMachinePatchStatus object itself. + */ + public VirtualMachinePatchStatus withLastPatchInstallationSummary( + LastPatchInstallationSummary lastPatchInstallationSummary) { + this.lastPatchInstallationSummary = lastPatchInstallationSummary; + return this; + } + + /** + * Get the configurationStatuses property: The enablement status of the specified patchMode. + * + * @return the configurationStatuses value. + */ + public List configurationStatuses() { + return this.configurationStatuses; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (availablePatchSummary() != null) { + availablePatchSummary().validate(); + } + if (lastPatchInstallationSummary() != null) { + lastPatchInstallationSummary().validate(); + } + if (configurationStatuses() != null) { + configurationStatuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePriorityTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePriorityTypes.java new file mode 100644 index 0000000000000..aac10be4bb6bf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePriorityTypes.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualMachinePriorityTypes. */ +public final class VirtualMachinePriorityTypes extends ExpandableStringEnum { + /** Static value Regular for VirtualMachinePriorityTypes. */ + public static final VirtualMachinePriorityTypes REGULAR = fromString("Regular"); + + /** Static value Low for VirtualMachinePriorityTypes. */ + public static final VirtualMachinePriorityTypes LOW = fromString("Low"); + + /** Static value Spot for VirtualMachinePriorityTypes. */ + public static final VirtualMachinePriorityTypes SPOT = fromString("Spot"); + + /** + * Creates or finds a VirtualMachinePriorityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualMachinePriorityTypes. + */ + @JsonCreator + public static VirtualMachinePriorityTypes fromString(String name) { + return fromString(name, VirtualMachinePriorityTypes.class); + } + + /** @return known VirtualMachinePriorityTypes values. */ + public static Collection values() { + return values(VirtualMachinePriorityTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineProperties.java new file mode 100644 index 0000000000000..c556368f7a3dc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineProperties.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachinePropertiesInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of VirtualMachineProperties. */ +public interface VirtualMachineProperties { + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the osProfile property: Specifies the operating system settings used while creating the virtual machine. + * Some of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + SecurityProfile securityProfile(); + + /** + * Gets the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + DiagnosticsProfile diagnosticsProfile(); + + /** + * Gets the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + SubResource availabilitySet(); + + /** + * Gets the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + SubResource virtualMachineScaleSet(); + + /** + * Gets the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + SubResource proximityPlacementGroup(); + + /** + * Gets the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + VirtualMachinePriorityTypes priority(); + + /** + * Gets the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + VirtualMachineEvictionPolicyTypes evictionPolicy(); + + /** + * Gets the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + BillingProfile billingProfile(); + + /** + * Gets the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + SubResource host(); + + /** + * Gets the hostGroup property: Specifies information about the dedicated host group that the virtual machine + * resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify + * both host and hostGroup properties. + * + * @return the hostGroup value. + */ + SubResource hostGroup(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + VirtualMachineInstanceView instanceView(); + + /** + * Gets the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + String licenseType(); + + /** + * Gets the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + String extensionsTimeBudget(); + + /** + * Gets the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual + * Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that + * best maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + ScheduledEventsProfile scheduledEventsProfile(); + + /** + * Gets the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + String userData(); + + /** + * Gets the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + CapacityReservationProfile capacityReservation(); + + /** + * Gets the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + ApplicationProfile applicationProfile(); + + /** + * Gets the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachinePropertiesInner object. + * + * @return the inner object. + */ + VirtualMachinePropertiesInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressConfiguration.java new file mode 100644 index 0000000000000..30b9afc39192e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressConfiguration.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachinePublicIpAddressConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachinePublicIpAddressConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachinePublicIpAddressConfiguration.class); + + /* + * The publicIP address configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machines IP Configuration's PublicIPAddress + * configuration + */ + @JsonProperty(value = "properties") + private VirtualMachinePublicIpAddressConfigurationProperties innerProperties; + + /* + * Describes the public IP Sku. It can only be set with OrchestrationMode + * as Flexible. + */ + @JsonProperty(value = "sku") + private PublicIpAddressSku sku; + + /** + * Get the name property: The publicIP address configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The publicIP address configuration name. + * + * @param name the name value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machines IP Configuration's PublicIPAddress configuration. + * + * @return the innerProperties value. + */ + private VirtualMachinePublicIpAddressConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + * + * @return the sku value. + */ + public PublicIpAddressSku sku() { + return this.sku; + } + + /** + * Set the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + * + * @param sku the sku value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withSku(PublicIpAddressSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().idleTimeoutInMinutes(); + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withIdleTimeoutInMinutes(Integer idleTimeoutInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withIdleTimeoutInMinutes(idleTimeoutInMinutes); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP address when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the public IP address when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withDnsSettings( + VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the ipTags property: The list of IP tags associated with the public IP address. + * + * @return the ipTags value. + */ + public List ipTags() { + return this.innerProperties() == null ? null : this.innerProperties().ipTags(); + } + + /** + * Set the ipTags property: The list of IP tags associated with the public IP address. + * + * @param ipTags the ipTags value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withIpTags(List ipTags) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withIpTags(ipTags); + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpPrefix(); + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withPublicIpPrefix(SubResource publicIpPrefix) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpPrefix(publicIpPrefix); + return this; + } + + /** + * Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the publicIpAddressVersion value. + */ + public IpVersions publicIpAddressVersion() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressVersion(); + } + + /** + * Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param publicIpAddressVersion the publicIpAddressVersion value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withPublicIpAddressVersion(IpVersions publicIpAddressVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpAddressVersion(publicIpAddressVersion); + return this; + } + + /** + * Get the publicIpAllocationMethod property: Specify the public IP allocation type. + * + * @return the publicIpAllocationMethod value. + */ + public PublicIpAllocationMethod publicIpAllocationMethod() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAllocationMethod(); + } + + /** + * Set the publicIpAllocationMethod property: Specify the public IP allocation type. + * + * @param publicIpAllocationMethod the publicIpAllocationMethod value to set. + * @return the VirtualMachinePublicIpAddressConfiguration object itself. + */ + public VirtualMachinePublicIpAddressConfiguration withPublicIpAllocationMethod( + PublicIpAllocationMethod publicIpAllocationMethod) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpAllocationMethod(publicIpAllocationMethod); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachinePublicIpAddressConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressDnsSettingsConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressDnsSettingsConfiguration.java new file mode 100644 index 0000000000000..c1ed850e22121 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachinePublicIpAddressDnsSettingsConfiguration.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machines network configuration's DNS settings. */ +@Fluent +public final class VirtualMachinePublicIpAddressDnsSettingsConfiguration { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachinePublicIpAddressDnsSettingsConfiguration.class); + + /* + * The Domain name label prefix of the PublicIPAddress resources that will + * be created. The generated name label is the concatenation of the domain + * name label and vm network profile unique ID. + */ + @JsonProperty(value = "domainNameLabel", required = true) + private String domainNameLabel; + + /** + * Get the domainNameLabel property: The Domain name label prefix of the PublicIPAddress resources that will be + * created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. + * + * @return the domainNameLabel value. + */ + public String domainNameLabel() { + return this.domainNameLabel; + } + + /** + * Set the domainNameLabel property: The Domain name label prefix of the PublicIPAddress resources that will be + * created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. + * + * @param domainNameLabel the domainNameLabel value to set. + * @return the VirtualMachinePublicIpAddressDnsSettingsConfiguration object itself. + */ + public VirtualMachinePublicIpAddressDnsSettingsConfiguration withDomainNameLabel(String domainNameLabel) { + this.domainNameLabel = domainNameLabel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (domainNameLabel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property domainNameLabel in model" + + " VirtualMachinePublicIpAddressDnsSettingsConfiguration")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineReimageParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineReimageParameters.java new file mode 100644 index 0000000000000..63f6304c6adc3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineReimageParameters.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be reimaged. */ +@Fluent +public class VirtualMachineReimageParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineReimageParameters.class); + + /* + * Specifies whether to reimage temp disk. Default value: false. Note: This + * temp disk reimage parameter is only supported for VM/VMSS with Ephemeral + * OS disk. + */ + @JsonProperty(value = "tempDisk") + private Boolean tempDisk; + + /** + * Get the tempDisk property: Specifies whether to reimage temp disk. Default value: false. Note: This temp disk + * reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + * + * @return the tempDisk value. + */ + public Boolean tempDisk() { + return this.tempDisk; + } + + /** + * Set the tempDisk property: Specifies whether to reimage temp disk. Default value: false. Note: This temp disk + * reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + * + * @param tempDisk the tempDisk value to set. + * @return the VirtualMachineReimageParameters object itself. + */ + public VirtualMachineReimageParameters withTempDisk(Boolean tempDisk) { + this.tempDisk = tempDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommand.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommand.java new file mode 100644 index 0000000000000..4b3222a16ec8a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommand.java @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineRunCommand. */ +public interface VirtualMachineRunCommand { + /** + * 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 source property: The source of the run command script. + * + * @return the source value. + */ + VirtualMachineRunCommandScriptSource source(); + + /** + * Gets the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + List parameters(); + + /** + * Gets the protectedParameters property: The parameters used by the script. + * + * @return the protectedParameters value. + */ + List protectedParameters(); + + /** + * Gets the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @return the asyncExecution value. + */ + Boolean asyncExecution(); + + /** + * Gets the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value. + */ + String runAsUser(); + + /** + * Gets the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value. + */ + String runAsPassword(); + + /** + * Gets the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value. + */ + Integer timeoutInSeconds(); + + /** + * Gets the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value. + */ + String outputBlobUri(); + + /** + * Gets the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value. + */ + String errorBlobUri(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine run command instance view. + * + * @return the instanceView value. + */ + VirtualMachineRunCommandInstanceView instanceView(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner object. + * + * @return the inner object. + */ + VirtualMachineRunCommandInner innerModel(); + + /** The entirety of the VirtualMachineRunCommand definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The VirtualMachineRunCommand definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineRunCommand definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vmName. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String vmName); + } + /** + * The stage of the VirtualMachineRunCommand 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.WithSource, + DefinitionStages.WithParameters, + DefinitionStages.WithProtectedParameters, + DefinitionStages.WithAsyncExecution, + DefinitionStages.WithRunAsUser, + DefinitionStages.WithRunAsPassword, + DefinitionStages.WithTimeoutInSeconds, + DefinitionStages.WithOutputBlobUri, + DefinitionStages.WithErrorBlobUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineRunCommand create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineRunCommand create(Context context); + } + /** The stage of the VirtualMachineRunCommand 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 VirtualMachineRunCommand definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: The source of the run command script.. + * + * @param source The source of the run command script. + * @return the next definition stage. + */ + WithCreate withSource(VirtualMachineRunCommandScriptSource source); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify parameters. */ + interface WithParameters { + /** + * Specifies the parameters property: The parameters used by the script.. + * + * @param parameters The parameters used by the script. + * @return the next definition stage. + */ + WithCreate withParameters(List parameters); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify protectedParameters. */ + interface WithProtectedParameters { + /** + * Specifies the protectedParameters property: The parameters used by the script.. + * + * @param protectedParameters The parameters used by the script. + * @return the next definition stage. + */ + WithCreate withProtectedParameters(List protectedParameters); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify asyncExecution. */ + interface WithAsyncExecution { + /** + * Specifies the asyncExecution property: Optional. If set to true, provisioning will complete as soon as + * the script starts and will not wait for script to complete.. + * + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts + * and will not wait for script to complete. + * @return the next definition stage. + */ + WithCreate withAsyncExecution(Boolean asyncExecution); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify runAsUser. */ + interface WithRunAsUser { + /** + * Specifies the runAsUser property: Specifies the user account on the VM when executing the run command.. + * + * @param runAsUser Specifies the user account on the VM when executing the run command. + * @return the next definition stage. + */ + WithCreate withRunAsUser(String runAsUser); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify runAsPassword. */ + interface WithRunAsPassword { + /** + * Specifies the runAsPassword property: Specifies the user account password on the VM when executing the + * run command.. + * + * @param runAsPassword Specifies the user account password on the VM when executing the run command. + * @return the next definition stage. + */ + WithCreate withRunAsPassword(String runAsPassword); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify timeoutInSeconds. */ + interface WithTimeoutInSeconds { + /** + * Specifies the timeoutInSeconds property: The timeout in seconds to execute the run command.. + * + * @param timeoutInSeconds The timeout in seconds to execute the run command. + * @return the next definition stage. + */ + WithCreate withTimeoutInSeconds(Integer timeoutInSeconds); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify outputBlobUri. */ + interface WithOutputBlobUri { + /** + * Specifies the outputBlobUri property: Specifies the Azure storage blob where script output stream will be + * uploaded.. + * + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. + * @return the next definition stage. + */ + WithCreate withOutputBlobUri(String outputBlobUri); + } + /** The stage of the VirtualMachineRunCommand definition allowing to specify errorBlobUri. */ + interface WithErrorBlobUri { + /** + * Specifies the errorBlobUri property: Specifies the Azure storage blob where script error stream will be + * uploaded.. + * + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. + * @return the next definition stage. + */ + WithCreate withErrorBlobUri(String errorBlobUri); + } + } + /** + * Begins update for the VirtualMachineRunCommand resource. + * + * @return the stage of resource update. + */ + VirtualMachineRunCommand.Update update(); + + /** The template for VirtualMachineRunCommand update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSource, + UpdateStages.WithParameters, + UpdateStages.WithProtectedParameters, + UpdateStages.WithAsyncExecution, + UpdateStages.WithRunAsUser, + UpdateStages.WithRunAsPassword, + UpdateStages.WithTimeoutInSeconds, + UpdateStages.WithOutputBlobUri, + UpdateStages.WithErrorBlobUri { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineRunCommand apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineRunCommand apply(Context context); + } + /** The VirtualMachineRunCommand update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineRunCommand 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 VirtualMachineRunCommand update allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: The source of the run command script.. + * + * @param source The source of the run command script. + * @return the next definition stage. + */ + Update withSource(VirtualMachineRunCommandScriptSource source); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify parameters. */ + interface WithParameters { + /** + * Specifies the parameters property: The parameters used by the script.. + * + * @param parameters The parameters used by the script. + * @return the next definition stage. + */ + Update withParameters(List parameters); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify protectedParameters. */ + interface WithProtectedParameters { + /** + * Specifies the protectedParameters property: The parameters used by the script.. + * + * @param protectedParameters The parameters used by the script. + * @return the next definition stage. + */ + Update withProtectedParameters(List protectedParameters); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify asyncExecution. */ + interface WithAsyncExecution { + /** + * Specifies the asyncExecution property: Optional. If set to true, provisioning will complete as soon as + * the script starts and will not wait for script to complete.. + * + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts + * and will not wait for script to complete. + * @return the next definition stage. + */ + Update withAsyncExecution(Boolean asyncExecution); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify runAsUser. */ + interface WithRunAsUser { + /** + * Specifies the runAsUser property: Specifies the user account on the VM when executing the run command.. + * + * @param runAsUser Specifies the user account on the VM when executing the run command. + * @return the next definition stage. + */ + Update withRunAsUser(String runAsUser); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify runAsPassword. */ + interface WithRunAsPassword { + /** + * Specifies the runAsPassword property: Specifies the user account password on the VM when executing the + * run command.. + * + * @param runAsPassword Specifies the user account password on the VM when executing the run command. + * @return the next definition stage. + */ + Update withRunAsPassword(String runAsPassword); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify timeoutInSeconds. */ + interface WithTimeoutInSeconds { + /** + * Specifies the timeoutInSeconds property: The timeout in seconds to execute the run command.. + * + * @param timeoutInSeconds The timeout in seconds to execute the run command. + * @return the next definition stage. + */ + Update withTimeoutInSeconds(Integer timeoutInSeconds); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify outputBlobUri. */ + interface WithOutputBlobUri { + /** + * Specifies the outputBlobUri property: Specifies the Azure storage blob where script output stream will be + * uploaded.. + * + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. + * @return the next definition stage. + */ + Update withOutputBlobUri(String outputBlobUri); + } + /** The stage of the VirtualMachineRunCommand update allowing to specify errorBlobUri. */ + interface WithErrorBlobUri { + /** + * Specifies the errorBlobUri property: Specifies the Azure storage blob where script error stream will be + * uploaded.. + * + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. + * @return the next definition stage. + */ + Update withErrorBlobUri(String errorBlobUri); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachineRunCommand refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineRunCommand refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandInstanceView.java new file mode 100644 index 0000000000000..751401d6ca58a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandInstanceView.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The instance view of a virtual machine run command. */ +@Fluent +public final class VirtualMachineRunCommandInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandInstanceView.class); + + /* + * Script execution status. + */ + @JsonProperty(value = "executionState") + private ExecutionState executionState; + + /* + * Communicate script configuration errors or execution messages. + */ + @JsonProperty(value = "executionMessage") + private String executionMessage; + + /* + * Exit code returned from script execution. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /* + * Script output stream. + */ + @JsonProperty(value = "output") + private String output; + + /* + * Script error stream. + */ + @JsonProperty(value = "error") + private String error; + + /* + * Script start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Script end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get the executionState property: Script execution status. + * + * @return the executionState value. + */ + public ExecutionState executionState() { + return this.executionState; + } + + /** + * Set the executionState property: Script execution status. + * + * @param executionState the executionState value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExecutionState(ExecutionState executionState) { + this.executionState = executionState; + return this; + } + + /** + * Get the executionMessage property: Communicate script configuration errors or execution messages. + * + * @return the executionMessage value. + */ + public String executionMessage() { + return this.executionMessage; + } + + /** + * Set the executionMessage property: Communicate script configuration errors or execution messages. + * + * @param executionMessage the executionMessage value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExecutionMessage(String executionMessage) { + this.executionMessage = executionMessage; + return this; + } + + /** + * Get the exitCode property: Exit code returned from script execution. + * + * @return the exitCode value. + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set the exitCode property: Exit code returned from script execution. + * + * @param exitCode the exitCode value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get the output property: Script output stream. + * + * @return the output value. + */ + public String output() { + return this.output; + } + + /** + * Set the output property: Script output stream. + * + * @param output the output value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withOutput(String output) { + this.output = output; + return this; + } + + /** + * Get the error property: Script error stream. + * + * @return the error value. + */ + public String error() { + return this.error; + } + + /** + * Set the error property: Script error stream. + * + * @param error the error value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withError(String error) { + this.error = error; + return this; + } + + /** + * Get the startTime property: Script start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Script start time. + * + * @param startTime the startTime value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Script end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Script end time. + * + * @param endTime the endTime value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The resource status information. + * + * @param statuses the statuses value to set. + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandScriptSource.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandScriptSource.java new file mode 100644 index 0000000000000..0096650ef18b3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandScriptSource.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the script sources for run command. */ +@Fluent +public final class VirtualMachineRunCommandScriptSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandScriptSource.class); + + /* + * Specifies the script content to be executed on the VM. + */ + @JsonProperty(value = "script") + private String script; + + /* + * Specifies the script download location. + */ + @JsonProperty(value = "scriptUri") + private String scriptUri; + + /* + * Specifies a commandId of predefined built-in script. + */ + @JsonProperty(value = "commandId") + private String commandId; + + /** + * Get the script property: Specifies the script content to be executed on the VM. + * + * @return the script value. + */ + public String script() { + return this.script; + } + + /** + * Set the script property: Specifies the script content to be executed on the VM. + * + * @param script the script value to set. + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withScript(String script) { + this.script = script; + return this; + } + + /** + * Get the scriptUri property: Specifies the script download location. + * + * @return the scriptUri value. + */ + public String scriptUri() { + return this.scriptUri; + } + + /** + * Set the scriptUri property: Specifies the script download location. + * + * @param scriptUri the scriptUri value to set. + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withScriptUri(String scriptUri) { + this.scriptUri = scriptUri; + return this; + } + + /** + * Get the commandId property: Specifies a commandId of predefined built-in script. + * + * @return the commandId value. + */ + public String commandId() { + return this.commandId; + } + + /** + * Set the commandId property: Specifies a commandId of predefined built-in script. + * + * @param commandId the commandId value to set. + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withCommandId(String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandUpdate.java new file mode 100644 index 0000000000000..86aaa512cc4b5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandUpdate.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Describes a Virtual Machine run command. */ +@Fluent +public final class VirtualMachineRunCommandUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandUpdate.class); + + /* + * Describes the properties of a Virtual Machine run command. + */ + @JsonProperty(value = "properties") + private VirtualMachineRunCommandProperties innerProperties; + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine run command. + * + * @return the innerProperties value. + */ + private VirtualMachineRunCommandProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineRunCommandUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the source property: The source of the run command script. + * + * @return the source value. + */ + public VirtualMachineRunCommandScriptSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The source of the run command script. + * + * @param source the source value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withSource(VirtualMachineRunCommandScriptSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the parameters property: The parameters used by the script. + * + * @return the parameters value. + */ + public List parameters() { + return this.innerProperties() == null ? null : this.innerProperties().parameters(); + } + + /** + * Set the parameters property: The parameters used by the script. + * + * @param parameters the parameters value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withParameters(List parameters) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withParameters(parameters); + return this; + } + + /** + * Get the protectedParameters property: The parameters used by the script. + * + * @return the protectedParameters value. + */ + public List protectedParameters() { + return this.innerProperties() == null ? null : this.innerProperties().protectedParameters(); + } + + /** + * Set the protectedParameters property: The parameters used by the script. + * + * @param protectedParameters the protectedParameters value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withProtectedParameters(List protectedParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withProtectedParameters(protectedParameters); + return this; + } + + /** + * Get the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @return the asyncExecution value. + */ + public Boolean asyncExecution() { + return this.innerProperties() == null ? null : this.innerProperties().asyncExecution(); + } + + /** + * Set the asyncExecution property: Optional. If set to true, provisioning will complete as soon as the script + * starts and will not wait for script to complete. + * + * @param asyncExecution the asyncExecution value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withAsyncExecution(Boolean asyncExecution) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withAsyncExecution(asyncExecution); + return this; + } + + /** + * Get the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value. + */ + public String runAsUser() { + return this.innerProperties() == null ? null : this.innerProperties().runAsUser(); + } + + /** + * Set the runAsUser property: Specifies the user account on the VM when executing the run command. + * + * @param runAsUser the runAsUser value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withRunAsUser(String runAsUser) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withRunAsUser(runAsUser); + return this; + } + + /** + * Get the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value. + */ + public String runAsPassword() { + return this.innerProperties() == null ? null : this.innerProperties().runAsPassword(); + } + + /** + * Set the runAsPassword property: Specifies the user account password on the VM when executing the run command. + * + * @param runAsPassword the runAsPassword value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withRunAsPassword(String runAsPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withRunAsPassword(runAsPassword); + return this; + } + + /** + * Get the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value. + */ + public Integer timeoutInSeconds() { + return this.innerProperties() == null ? null : this.innerProperties().timeoutInSeconds(); + } + + /** + * Set the timeoutInSeconds property: The timeout in seconds to execute the run command. + * + * @param timeoutInSeconds the timeoutInSeconds value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withTimeoutInSeconds(Integer timeoutInSeconds) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withTimeoutInSeconds(timeoutInSeconds); + return this; + } + + /** + * Get the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value. + */ + public String outputBlobUri() { + return this.innerProperties() == null ? null : this.innerProperties().outputBlobUri(); + } + + /** + * Set the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. + * + * @param outputBlobUri the outputBlobUri value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withOutputBlobUri(String outputBlobUri) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withOutputBlobUri(outputBlobUri); + return this; + } + + /** + * Get the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value. + */ + public String errorBlobUri() { + return this.innerProperties() == null ? null : this.innerProperties().errorBlobUri(); + } + + /** + * Set the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. + * + * @param errorBlobUri the errorBlobUri value to set. + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withErrorBlobUri(String errorBlobUri) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineRunCommandProperties(); + } + this.innerProperties().withErrorBlobUri(errorBlobUri); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The virtual machine run command instance view. + * + * @return the instanceView value. + */ + public VirtualMachineRunCommandInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommands.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommands.java new file mode 100644 index 0000000000000..cdbf93bafac91 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommands.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 VirtualMachineRunCommands. */ +public interface VirtualMachineRunCommands { + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(String location); + + /** + * Lists all available run commands for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(String location, Context context); + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command 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 specific run command for a subscription in a location. + */ + RunCommandDocument get(String location, String commandId); + + /** + * Gets specific run command for a subscription in a location. + * + * @param location The location upon which run commands is queried. + * @param commandId The command 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 specific run command for a subscription in a location along with {@link Response}. + */ + Response getWithResponse(String location, String commandId, Context context); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String runCommandName); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, String runCommandName, Context context); + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand getByVirtualMachine(String resourceGroupName, String vmName, String runCommandName); + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + Response getByVirtualMachineWithResponse( + String resourceGroupName, String vmName, String runCommandName, String expand, Context context); + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + PagedIterable listByVirtualMachine(String resourceGroupName, String vmName); + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + PagedIterable listByVirtualMachine( + String resourceGroupName, String vmName, String expand, Context context); + + /** + * The operation to get the run command. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + VirtualMachineRunCommand getById(String id); + + /** + * The operation to get the run command. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * The operation to delete the run command. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the run command. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 VirtualMachineRunCommand resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineRunCommand definition. + */ + VirtualMachineRunCommand.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandsListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandsListResult.java new file mode 100644 index 0000000000000..840086be92935 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineRunCommandsListResult.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List run command operation response. */ +@Fluent +public final class VirtualMachineRunCommandsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineRunCommandsListResult.class); + + /* + * The list of run commands + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of run commands. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of run commands. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of run commands. + * + * @param value the value value to set. + * @return the VirtualMachineRunCommandsListResult object itself. + */ + public VirtualMachineRunCommandsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of run commands. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of run commands. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineRunCommandsListResult object itself. + */ + public VirtualMachineRunCommandsListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineRunCommandsListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSet.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSet.java new file mode 100644 index 0000000000000..95323d5d1c6cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSet.java @@ -0,0 +1,1168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineScaleSet. */ +public interface VirtualMachineScaleSet { + /** + * 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 sku property: The virtual machine scale set sku. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Specifies information about the marketplace image used to create the virtual machine. + * This element is only used for marketplace images. Before you can use a marketplace image from an API, you must + * enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and + * then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the identity property: The identity of the virtual machine scale set, if configured. + * + * @return the identity value. + */ + VirtualMachineScaleSetIdentity identity(); + + /** + * Gets the zones property: The virtual machine scale set zones. NOTE: Availability zones can only be set when you + * create the scale set. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the extendedLocation property: The extended location of the Virtual Machine Scale Set. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the upgradePolicy property: The upgrade policy. + * + * @return the upgradePolicy value. + */ + UpgradePolicy upgradePolicy(); + + /** + * Gets the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @return the automaticRepairsPolicy value. + */ + AutomaticRepairsPolicy automaticRepairsPolicy(); + + /** + * Gets the virtualMachineProfile property: The virtual machine profile. + * + * @return the virtualMachineProfile value. + */ + VirtualMachineScaleSetVMProfile virtualMachineProfile(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @return the overprovision value. + */ + Boolean overprovision(); + + /** + * Gets the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @return the doNotRunExtensionsOnOverprovisionedVMs value. + */ + Boolean doNotRunExtensionsOnOverprovisionedVMs(); + + /** + * Gets the uniqueId property: Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * Gets the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @return the singlePlacementGroup value. + */ + Boolean singlePlacementGroup(); + + /** + * Gets the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set contains more + * than one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + * + * @return the zoneBalance value. + */ + Boolean zoneBalance(); + + /** + * Gets the platformFaultDomainCount property: Fault Domain count for each placement group. + * + * @return the platformFaultDomainCount value. + */ + Integer platformFaultDomainCount(); + + /** + * Gets the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + SubResource proximityPlacementGroup(); + + /** + * Gets the hostGroup property: Specifies information about the dedicated host group that the virtual machine scale + * set resides in. <br><br>Minimum api-version: 2020-06-01. + * + * @return the hostGroup value. + */ + SubResource hostGroup(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @return the scaleInPolicy value. + */ + ScaleInPolicy scaleInPolicy(); + + /** + * Gets the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale set. + * + * @return the orchestrationMode value. + */ + OrchestrationMode orchestrationMode(); + + /** + * Gets the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine scale set. + * + * @return the spotRestorePolicy value. + */ + SpotRestorePolicy spotRestorePolicy(); + + /** + * Gets the timeCreated property: Specifies the time at which the Virtual Machine Scale Set resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * 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 inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner object. + * + * @return the inner object. + */ + VirtualMachineScaleSetInner innerModel(); + + /** The entirety of the VirtualMachineScaleSet definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The VirtualMachineScaleSet definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineScaleSet definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachineScaleSet 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 VirtualMachineScaleSet definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the VirtualMachineScaleSet 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.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithIdentity, + DefinitionStages.WithZones, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithUpgradePolicy, + DefinitionStages.WithAutomaticRepairsPolicy, + DefinitionStages.WithVirtualMachineProfile, + DefinitionStages.WithOverprovision, + DefinitionStages.WithDoNotRunExtensionsOnOverprovisionedVMs, + DefinitionStages.WithSinglePlacementGroup, + DefinitionStages.WithZoneBalance, + DefinitionStages.WithPlatformFaultDomainCount, + DefinitionStages.WithProximityPlacementGroup, + DefinitionStages.WithHostGroup, + DefinitionStages.WithAdditionalCapabilities, + DefinitionStages.WithScaleInPolicy, + DefinitionStages.WithOrchestrationMode, + DefinitionStages.WithSpotRestorePolicy { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineScaleSet create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineScaleSet create(Context context); + } + /** The stage of the VirtualMachineScaleSet 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 VirtualMachineScaleSet definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The virtual machine scale set sku.. + * + * @param sku The virtual machine scale set sku. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Specifies information about the marketplace image used to create the virtual + * machine. This element is only used for marketplace images. Before you can use a marketplace image from an + * API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that + * you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**.. + * + * @param plan Specifies information about the marketplace image used to create the virtual machine. This + * element is only used for marketplace images. Before you can use a marketplace image from an API, you + * must enable the image for programmatic use. In the Azure portal, find the marketplace image that you + * want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required + * information and then click **Save**. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the virtual machine scale set, if configured.. + * + * @param identity The identity of the virtual machine scale set, if configured. + * @return the next definition stage. + */ + WithCreate withIdentity(VirtualMachineScaleSetIdentity identity); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify zones. */ + interface WithZones { + /** + * Specifies the zones property: The virtual machine scale set zones. NOTE: Availability zones can only be + * set when you create the scale set. + * + * @param zones The virtual machine scale set zones. NOTE: Availability zones can only be set when you + * create the scale set. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location of the Virtual Machine Scale Set.. + * + * @param extendedLocation The extended location of the Virtual Machine Scale Set. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify upgradePolicy. */ + interface WithUpgradePolicy { + /** + * Specifies the upgradePolicy property: The upgrade policy.. + * + * @param upgradePolicy The upgrade policy. + * @return the next definition stage. + */ + WithCreate withUpgradePolicy(UpgradePolicy upgradePolicy); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify automaticRepairsPolicy. */ + interface WithAutomaticRepairsPolicy { + /** + * Specifies the automaticRepairsPolicy property: Policy for automatic repairs.. + * + * @param automaticRepairsPolicy Policy for automatic repairs. + * @return the next definition stage. + */ + WithCreate withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify virtualMachineProfile. */ + interface WithVirtualMachineProfile { + /** + * Specifies the virtualMachineProfile property: The virtual machine profile.. + * + * @param virtualMachineProfile The virtual machine profile. + * @return the next definition stage. + */ + WithCreate withVirtualMachineProfile(VirtualMachineScaleSetVMProfile virtualMachineProfile); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify overprovision. */ + interface WithOverprovision { + /** + * Specifies the overprovision property: Specifies whether the Virtual Machine Scale Set should be + * overprovisioned.. + * + * @param overprovision Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * @return the next definition stage. + */ + WithCreate withOverprovision(Boolean overprovision); + } + /** + * The stage of the VirtualMachineScaleSet definition allowing to specify + * doNotRunExtensionsOnOverprovisionedVMs. + */ + interface WithDoNotRunExtensionsOnOverprovisionedVMs { + /** + * Specifies the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions + * are launched only on the requested number of VMs which are finally kept. This property will hence ensure + * that the extensions do not run on the extra overprovisioned VMs.. + * + * @param doNotRunExtensionsOnOverprovisionedVMs When Overprovision is enabled, extensions are launched only + * on the requested number of VMs which are finally kept. This property will hence ensure that the + * extensions do not run on the extra overprovisioned VMs. + * @return the next definition stage. + */ + WithCreate withDoNotRunExtensionsOnOverprovisionedVMs(Boolean doNotRunExtensionsOnOverprovisionedVMs); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify singlePlacementGroup. */ + interface WithSinglePlacementGroup { + /** + * Specifies the singlePlacementGroup property: When true this limits the scale set to a single placement + * group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + * false. However, if singlePlacementGroup is false, it may not be modified to true.. + * + * @param singlePlacementGroup When true this limits the scale set to a single placement group, of max size + * 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * @return the next definition stage. + */ + WithCreate withSinglePlacementGroup(Boolean singlePlacementGroup); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify zoneBalance. */ + interface WithZoneBalance { + /** + * Specifies the zoneBalance property: Whether to force strictly even Virtual Machine distribution cross + * x-zones in case there is zone outage. zoneBalance property can only be set if the zones property of the + * scale set contains more than one zone. If there are no zones or only one zone specified, then zoneBalance + * property should not be set.. + * + * @param zoneBalance Whether to force strictly even Virtual Machine distribution cross x-zones in case + * there is zone outage. zoneBalance property can only be set if the zones property of the scale set + * contains more than one zone. If there are no zones or only one zone specified, then zoneBalance + * property should not be set. + * @return the next definition stage. + */ + WithCreate withZoneBalance(Boolean zoneBalance); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify platformFaultDomainCount. */ + interface WithPlatformFaultDomainCount { + /** + * Specifies the platformFaultDomainCount property: Fault Domain count for each placement group.. + * + * @param platformFaultDomainCount Fault Domain count for each placement group. + * @return the next definition stage. + */ + WithCreate withPlatformFaultDomainCount(Integer platformFaultDomainCount); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: + * 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the virtual + * machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + WithCreate withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify hostGroup. */ + interface WithHostGroup { + /** + * Specifies the hostGroup property: Specifies information about the dedicated host group that the virtual + * machine scale set resides in. <br><br>Minimum api-version: 2020-06-01.. + * + * @param hostGroup Specifies information about the dedicated host group that the virtual machine scale set + * resides in. <br><br>Minimum api-version: 2020-06-01. + * @return the next definition stage. + */ + WithCreate withHostGroup(SubResource hostGroup); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify additionalCapabilities. */ + interface WithAdditionalCapabilities { + /** + * Specifies the additionalCapabilities property: Specifies additional capabilities enabled or disabled on + * the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have + * the capability to support attaching managed data disks with UltraSSD_LRS storage account type.. + * + * @param additionalCapabilities Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the + * capability to support attaching managed data disks with UltraSSD_LRS storage account type. + * @return the next definition stage. + */ + WithCreate withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify scaleInPolicy. */ + interface WithScaleInPolicy { + /** + * Specifies the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in + * the Virtual Machine Scale Set.. + * + * @param scaleInPolicy Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * @return the next definition stage. + */ + WithCreate withScaleInPolicy(ScaleInPolicy scaleInPolicy); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify orchestrationMode. */ + interface WithOrchestrationMode { + /** + * Specifies the orchestrationMode property: Specifies the orchestration mode for the virtual machine scale + * set.. + * + * @param orchestrationMode Specifies the orchestration mode for the virtual machine scale set. + * @return the next definition stage. + */ + WithCreate withOrchestrationMode(OrchestrationMode orchestrationMode); + } + /** The stage of the VirtualMachineScaleSet definition allowing to specify spotRestorePolicy. */ + interface WithSpotRestorePolicy { + /** + * Specifies the spotRestorePolicy property: Specifies the Spot Restore properties for the virtual machine + * scale set.. + * + * @param spotRestorePolicy Specifies the Spot Restore properties for the virtual machine scale set. + * @return the next definition stage. + */ + WithCreate withSpotRestorePolicy(SpotRestorePolicy spotRestorePolicy); + } + } + /** + * Begins update for the VirtualMachineScaleSet resource. + * + * @return the stage of resource update. + */ + VirtualMachineScaleSet.Update update(); + + /** The template for VirtualMachineScaleSet update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithPlan, + UpdateStages.WithIdentity, + UpdateStages.WithUpgradePolicy, + UpdateStages.WithAutomaticRepairsPolicy, + UpdateStages.WithVirtualMachineProfile, + UpdateStages.WithOverprovision, + UpdateStages.WithDoNotRunExtensionsOnOverprovisionedVMs, + UpdateStages.WithSinglePlacementGroup, + UpdateStages.WithAdditionalCapabilities, + UpdateStages.WithScaleInPolicy, + UpdateStages.WithProximityPlacementGroup { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineScaleSet apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineScaleSet apply(Context context); + } + /** The VirtualMachineScaleSet update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineScaleSet 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 VirtualMachineScaleSet update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The virtual machine scale set sku.. + * + * @param sku The virtual machine scale set sku. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The purchase plan when deploying a virtual machine scale set from VM + * Marketplace images.. + * + * @param plan The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + * @return the next definition stage. + */ + Update withPlan(Plan plan); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the virtual machine scale set, if configured.. + * + * @param identity The identity of the virtual machine scale set, if configured. + * @return the next definition stage. + */ + Update withIdentity(VirtualMachineScaleSetIdentity identity); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify upgradePolicy. */ + interface WithUpgradePolicy { + /** + * Specifies the upgradePolicy property: The upgrade policy.. + * + * @param upgradePolicy The upgrade policy. + * @return the next definition stage. + */ + Update withUpgradePolicy(UpgradePolicy upgradePolicy); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify automaticRepairsPolicy. */ + interface WithAutomaticRepairsPolicy { + /** + * Specifies the automaticRepairsPolicy property: Policy for automatic repairs.. + * + * @param automaticRepairsPolicy Policy for automatic repairs. + * @return the next definition stage. + */ + Update withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify virtualMachineProfile. */ + interface WithVirtualMachineProfile { + /** + * Specifies the virtualMachineProfile property: The virtual machine profile.. + * + * @param virtualMachineProfile The virtual machine profile. + * @return the next definition stage. + */ + Update withVirtualMachineProfile(VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify overprovision. */ + interface WithOverprovision { + /** + * Specifies the overprovision property: Specifies whether the Virtual Machine Scale Set should be + * overprovisioned.. + * + * @param overprovision Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * @return the next definition stage. + */ + Update withOverprovision(Boolean overprovision); + } + /** + * The stage of the VirtualMachineScaleSet update allowing to specify doNotRunExtensionsOnOverprovisionedVMs. + */ + interface WithDoNotRunExtensionsOnOverprovisionedVMs { + /** + * Specifies the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions + * are launched only on the requested number of VMs which are finally kept. This property will hence ensure + * that the extensions do not run on the extra overprovisioned VMs.. + * + * @param doNotRunExtensionsOnOverprovisionedVMs When Overprovision is enabled, extensions are launched only + * on the requested number of VMs which are finally kept. This property will hence ensure that the + * extensions do not run on the extra overprovisioned VMs. + * @return the next definition stage. + */ + Update withDoNotRunExtensionsOnOverprovisionedVMs(Boolean doNotRunExtensionsOnOverprovisionedVMs); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify singlePlacementGroup. */ + interface WithSinglePlacementGroup { + /** + * Specifies the singlePlacementGroup property: When true this limits the scale set to a single placement + * group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + * false. However, if singlePlacementGroup is false, it may not be modified to true.. + * + * @param singlePlacementGroup When true this limits the scale set to a single placement group, of max size + * 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * @return the next definition stage. + */ + Update withSinglePlacementGroup(Boolean singlePlacementGroup); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify additionalCapabilities. */ + interface WithAdditionalCapabilities { + /** + * Specifies the additionalCapabilities property: Specifies additional capabilities enabled or disabled on + * the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have + * the capability to support attaching managed data disks with UltraSSD_LRS storage account type.. + * + * @param additionalCapabilities Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the + * capability to support attaching managed data disks with UltraSSD_LRS storage account type. + * @return the next definition stage. + */ + Update withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify scaleInPolicy. */ + interface WithScaleInPolicy { + /** + * Specifies the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in + * the Virtual Machine Scale Set.. + * + * @param scaleInPolicy Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * @return the next definition stage. + */ + Update withScaleInPolicy(ScaleInPolicy scaleInPolicy); + } + /** The stage of the VirtualMachineScaleSet update allowing to specify proximityPlacementGroup. */ + interface WithProximityPlacementGroup { + /** + * Specifies the proximityPlacementGroup property: Specifies information about the proximity placement group + * that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: + * 2018-04-01.. + * + * @param proximityPlacementGroup Specifies information about the proximity placement group that the virtual + * machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * @return the next definition stage. + */ + Update withProximityPlacementGroup(SubResource proximityPlacementGroup); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachineScaleSet refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineScaleSet refresh(Context context); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances( + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion, Context context); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateInstances(VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Context context); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, Context context); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToSinglePlacementGroup(VMScaleSetConvertToSinglePlacementGroupInput parameters); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response convertToSinglePlacementGroupWithResponse( + VMScaleSetConvertToSinglePlacementGroupInput parameters, Context context); + + /** + * Changes ServiceState property for a given service. + * + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void setOrchestrationServiceState(OrchestrationServiceStateInput parameters); + + /** + * Changes ServiceState property for a given service. + * + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void setOrchestrationServiceState(OrchestrationServiceStateInput parameters, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetDataDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetDataDisk.java new file mode 100644 index 0000000000000..9d3a2af9dd9c1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetDataDisk.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machine scale set data disk. */ +@Fluent +public final class VirtualMachineScaleSetDataDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetDataDisk.class); + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the logical unit number of the data disk. This value is used + * to identify data disks within the VM and therefore must be unique for + * each data disk attached to a VM. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /* + * Specifies the caching requirements.

    Possible values are: + *

    **None**

    **ReadOnly**

    **ReadWrite**

    + * Default: **None for Standard storage. ReadOnly for Premium storage** + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + */ + @JsonProperty(value = "writeAcceleratorEnabled") + private Boolean writeAcceleratorEnabled; + + /* + * The create option. + */ + @JsonProperty(value = "createOption", required = true) + private DiskCreateOptionTypes createOption; + + /* + * Specifies the size of an empty data disk in gigabytes. This element can + * be used to overwrite the size of the disk in a virtual machine image. + *

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The managed disk parameters. + */ + @JsonProperty(value = "managedDisk") + private VirtualMachineScaleSetManagedDiskParameters managedDisk; + + /* + * Specifies the Read-Write IOPS for the managed disk. Should be used only + * when StorageAccountType is UltraSSD_LRS. If not specified, a default + * value would be assigned based on diskSizeGB. + */ + @JsonProperty(value = "diskIOPSReadWrite") + private Long diskIopsReadWrite; + + /* + * Specifies the bandwidth in MB per second for the managed disk. Should be + * used only when StorageAccountType is UltraSSD_LRS. If not specified, a + * default value would be assigned based on diskSizeGB. + */ + @JsonProperty(value = "diskMBpsReadWrite") + private Long diskMBpsReadWrite; + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @param lun the lun value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @param caching the caching value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the createOption property: The create option. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: The create option. + * + * @param createOption the createOption value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used to + * overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than + * 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineScaleSetManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withManagedDisk(VirtualMachineScaleSetManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the diskIopsReadWrite property: Specifies the Read-Write IOPS for the managed disk. Should be used only when + * StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.diskIopsReadWrite; + } + + /** + * Set the diskIopsReadWrite property: Specifies the Read-Write IOPS for the managed disk. Should be used only when + * StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskIopsReadWrite(Long diskIopsReadWrite) { + this.diskIopsReadWrite = diskIopsReadWrite; + return this; + } + + /** + * Get the diskMBpsReadWrite property: Specifies the bandwidth in MB per second for the managed disk. Should be used + * only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on + * diskSizeGB. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.diskMBpsReadWrite; + } + + /** + * Set the diskMBpsReadWrite property: Specifies the bandwidth in MB per second for the managed disk. Should be used + * only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on + * diskSizeGB. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + this.diskMBpsReadWrite = diskMBpsReadWrite; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property createOption in model VirtualMachineScaleSetDataDisk")); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtension.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtension.java new file mode 100644 index 0000000000000..98f3a068da8ef --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtension.java @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineScaleSetExtension. */ +public interface VirtualMachineScaleSetExtension { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the extension. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + String typeHandlerVersion(); + + /** + * Gets the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if + * one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + Boolean enableAutomaticUpgrade(); + + /** + * Gets the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + Object settings(); + + /** + * Gets the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + Object protectedSettings(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + List provisionAfterExtensions(); + + /** + * Gets the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + Boolean suppressFailures(); + + /** + * Gets the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + Object protectedSettingsFromKeyVault(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner + * object. + * + * @return the inner object. + */ + VirtualMachineScaleSetExtensionInner innerModel(); + + /** The entirety of the VirtualMachineScaleSetExtension definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualMachineScaleSetExtension definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineScaleSetExtension definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vmScaleSetName. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachineScaleSet(String resourceGroupName, String vmScaleSetName); + } + /** + * The stage of the VirtualMachineScaleSetExtension 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.WithName, + DefinitionStages.WithForceUpdateTag, + DefinitionStages.WithPublisher, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithTypeHandlerVersion, + DefinitionStages.WithAutoUpgradeMinorVersion, + DefinitionStages.WithEnableAutomaticUpgrade, + DefinitionStages.WithSettings, + DefinitionStages.WithProtectedSettings, + DefinitionStages.WithProvisionAfterExtensions, + DefinitionStages.WithSuppressFailures, + DefinitionStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineScaleSetExtension create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineScaleSetExtension create(Context context); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: The name of the extension.. + * + * @param name The name of the extension. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: If a value is provided and is different from the previous value, + * the extension handler will be forced to update even if the extension configuration has not changed.. + * + * @param forceUpdateTag If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * @return the next definition stage. + */ + WithCreate withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + WithCreate withPublisher(String publisher); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(String typePropertiesType); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + WithCreate withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + WithCreate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + WithCreate withSettings(Object settings); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + WithCreate withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify provisionAfterExtensions. */ + interface WithProvisionAfterExtensions { + /** + * Specifies the provisionAfterExtensions property: Collection of extension names after which this extension + * needs to be provisioned.. + * + * @param provisionAfterExtensions Collection of extension names after which this extension needs to be + * provisioned. + * @return the next definition stage. + */ + WithCreate withProvisionAfterExtensions(List provisionAfterExtensions); + } + /** The stage of the VirtualMachineScaleSetExtension definition allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + WithCreate withSuppressFailures(Boolean suppressFailures); + } + /** + * The stage of the VirtualMachineScaleSetExtension definition allowing to specify + * protectedSettingsFromKeyVault. + */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + WithCreate withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Begins update for the VirtualMachineScaleSetExtension resource. + * + * @return the stage of resource update. + */ + VirtualMachineScaleSetExtension.Update update(); + + /** The template for VirtualMachineScaleSetExtension update. */ + interface Update + extends UpdateStages.WithForceUpdateTag, + UpdateStages.WithPublisher, + UpdateStages.WithTypePropertiesType, + UpdateStages.WithTypeHandlerVersion, + UpdateStages.WithAutoUpgradeMinorVersion, + UpdateStages.WithEnableAutomaticUpgrade, + UpdateStages.WithSettings, + UpdateStages.WithProtectedSettings, + UpdateStages.WithProvisionAfterExtensions, + UpdateStages.WithSuppressFailures, + UpdateStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineScaleSetExtension apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineScaleSetExtension apply(Context context); + } + /** The VirtualMachineScaleSetExtension update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: If a value is provided and is different from the previous value, + * the extension handler will be forced to update even if the extension configuration has not changed.. + * + * @param forceUpdateTag If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + Update withPublisher(String publisher); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + Update withTypePropertiesType(String typePropertiesType); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + Update withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + Update withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + Update withSettings(Object settings); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + Update withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify provisionAfterExtensions. */ + interface WithProvisionAfterExtensions { + /** + * Specifies the provisionAfterExtensions property: Collection of extension names after which this extension + * needs to be provisioned.. + * + * @param provisionAfterExtensions Collection of extension names after which this extension needs to be + * provisioned. + * @return the next definition stage. + */ + Update withProvisionAfterExtensions(List provisionAfterExtensions); + } + /** The stage of the VirtualMachineScaleSetExtension update allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + Update withSuppressFailures(Boolean suppressFailures); + } + /** + * The stage of the VirtualMachineScaleSetExtension update allowing to specify protectedSettingsFromKeyVault. + */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + Update withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachineScaleSetExtension refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineScaleSetExtension refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionListResult.java new file mode 100644 index 0000000000000..36bc7d926bcd5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List VM scale set extension operation response. */ +@Fluent +public final class VirtualMachineScaleSetExtensionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionListResult.class); + + /* + * The list of VM scale set extensions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of VM scale set extensions. Call + * ListNext() with this to fetch the next page of VM scale set extensions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of VM scale set extensions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of VM scale set extensions. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetExtensionListResult object itself. + */ + public VirtualMachineScaleSetExtensionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of VM scale set extensions. Call ListNext() with this + * to fetch the next page of VM scale set extensions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of VM scale set extensions. Call ListNext() with this + * to fetch the next page of VM scale set extensions. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetExtensionListResult object itself. + */ + public VirtualMachineScaleSetExtensionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetExtensionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionProfile.java new file mode 100644 index 0000000000000..b09865dece416 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionProfile.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set extension profile. */ +@Fluent +public final class VirtualMachineScaleSetExtensionProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionProfile.class); + + /* + * The virtual machine scale set child extension resources. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /* + * Specifies the time alloted for all extensions to start. The time + * duration should be between 15 minutes and 120 minutes (inclusive) and + * should be specified in ISO 8601 format. The default value is 90 minutes + * (PT1H30M).

    Minimum api-version: 2020-06-01 + */ + @JsonProperty(value = "extensionsTimeBudget") + private String extensionsTimeBudget; + + /** + * Get the extensions property: The virtual machine scale set child extension resources. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: The virtual machine scale set child extension resources. + * + * @param extensions the extensions value to set. + * @return the VirtualMachineScaleSetExtensionProfile object itself. + */ + public VirtualMachineScaleSetExtensionProfile withExtensions( + List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + public String extensionsTimeBudget() { + return this.extensionsTimeBudget; + } + + /** + * Set the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @param extensionsTimeBudget the extensionsTimeBudget value to set. + * @return the VirtualMachineScaleSetExtensionProfile object itself. + */ + public VirtualMachineScaleSetExtensionProfile withExtensionsTimeBudget(String extensionsTimeBudget) { + this.extensionsTimeBudget = extensionsTimeBudget; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionUpdate.java new file mode 100644 index 0000000000000..dd22a3c6133b1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensionUpdate.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a Virtual Machine Scale Set Extension. */ +@Fluent +public final class VirtualMachineScaleSetExtensionUpdate extends SubResourceReadOnly { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetExtensionUpdate.class); + + /* + * The name of the extension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Describes the properties of a Virtual Machine Scale Set Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetExtensionProperties innerProperties; + + /** + * Get the name property: The name of the extension. + * + * @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: Describes the properties of a Virtual Machine Scale Set Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + public List provisionAfterExtensions() { + return this.innerProperties() == null ? null : this.innerProperties().provisionAfterExtensions(); + } + + /** + * Set the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @param provisionAfterExtensions the provisionAfterExtensions value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withProvisionAfterExtensions(List provisionAfterExtensions) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProvisionAfterExtensions(provisionAfterExtensions); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetExtensionUpdate object itself. + */ + public VirtualMachineScaleSetExtensionUpdate withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetExtensionProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensions.java new file mode 100644 index 0000000000000..2b41a5faadc66 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetExtensions.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 VirtualMachineScaleSetExtensions. */ +public interface VirtualMachineScaleSetExtensions { + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String vmssExtensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be deleted. + * @param vmssExtensionName The name of the VM scale set extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String vmssExtensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension. + */ + VirtualMachineScaleSetExtension get(String resourceGroupName, String vmScaleSetName, String vmssExtensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param vmssExtensionName The name of the VM scale set extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String vmssExtensionName, String expand, Context context); + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + PagedIterable list(String resourceGroupName, String vmScaleSetName); + + /** + * Gets a list of all extensions in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set containing the extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all extensions in a VM scale set. + */ + PagedIterable list( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response}. + */ + VirtualMachineScaleSetExtension getById(String id); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set Extension along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * The operation to delete the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the extension. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 VirtualMachineScaleSetExtension resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineScaleSetExtension definition. + */ + VirtualMachineScaleSetExtension.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetHardwareProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetHardwareProfile.java new file mode 100644 index 0000000000000..a3c16036800f8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetHardwareProfile.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the hardware settings for the virtual machine scale set. */ +@Fluent +public final class VirtualMachineScaleSetHardwareProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetHardwareProfile.class); + + /* + * Specifies the properties for customizing the size of the virtual + * machine. Minimum api-version: 2021-11-01.

    Please follow the + * instructions in [VM Customization](https://aka.ms/vmcustomization) for + * more details. + */ + @JsonProperty(value = "vmSizeProperties") + private VMSizeProperties vmSizeProperties; + + /** + * Get the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-11-01. <br><br> Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @return the vmSizeProperties value. + */ + public VMSizeProperties vmSizeProperties() { + return this.vmSizeProperties; + } + + /** + * Set the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-11-01. <br><br> Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @param vmSizeProperties the vmSizeProperties value to set. + * @return the VirtualMachineScaleSetHardwareProfile object itself. + */ + public VirtualMachineScaleSetHardwareProfile withVmSizeProperties(VMSizeProperties vmSizeProperties) { + this.vmSizeProperties = vmSizeProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmSizeProperties() != null) { + vmSizeProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentity.java new file mode 100644 index 0000000000000..979744dbc99f6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentity.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the virtual machine scale set. */ +@Fluent +public class VirtualMachineScaleSetIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetIdentity.class); + + /* + * The principal id of virtual machine scale set identity. This property + * will only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id associated with the virtual machine scale set. This + * property will only be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the virtual machine scale set. The type + * 'SystemAssigned, UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the virtual machine scale set. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the virtual machine scale + * set. The user identity dictionary key references will be ARM resource + * ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The principal id of virtual machine scale set 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 associated with the virtual machine scale set. 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 identity used for the virtual machine scale set. The type 'SystemAssigned, + * UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' + * will remove any identities from the virtual machine scale set. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the virtual machine scale set. The type 'SystemAssigned, + * UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' + * will remove any identities from the virtual machine scale set. + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetIdentity object itself. + */ + public VirtualMachineScaleSetIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the virtual machine scale + * set. The user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the virtual machine scale + * set. The user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the VirtualMachineScaleSetIdentity object itself. + */ + public VirtualMachineScaleSetIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..3e74509b5dd5b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue model. */ +@Immutable +public final class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user 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() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceView.java new file mode 100644 index 0000000000000..59483979049e0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceView.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineScaleSetInstanceView. */ +public interface VirtualMachineScaleSetInstanceView { + /** + * Gets the virtualMachine property: The instance view status summary for the virtual machine scale set. + * + * @return the virtualMachine value. + */ + VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine(); + + /** + * Gets the extensions property: The extensions information. + * + * @return the extensions value. + */ + List extensions(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the orchestrationServices property: The orchestration services information. + * + * @return the orchestrationServices value. + */ + List orchestrationServices(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInstanceViewInner + * object. + * + * @return the inner object. + */ + VirtualMachineScaleSetInstanceViewInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceViewStatusesSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceViewStatusesSummary.java new file mode 100644 index 0000000000000..2f1c5e861f7f4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetInstanceViewStatusesSummary.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Instance view statuses summary for virtual machines of a virtual machine scale set. */ +@Immutable +public final class VirtualMachineScaleSetInstanceViewStatusesSummary { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetInstanceViewStatusesSummary.class); + + /* + * The extensions information. + */ + @JsonProperty(value = "statusesSummary", access = JsonProperty.Access.WRITE_ONLY) + private List statusesSummary; + + /** + * Get the statusesSummary property: The extensions information. + * + * @return the statusesSummary value. + */ + public List statusesSummary() { + return this.statusesSummary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusesSummary() != null) { + statusesSummary().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpConfiguration.java new file mode 100644 index 0000000000000..491a1fee4b7cd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpConfiguration.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetIpConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's IP configuration. */ +@Fluent +public final class VirtualMachineScaleSetIpConfiguration extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetIpConfiguration.class); + + /* + * The IP configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machine scale set network profile's IP configuration + * properties. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetIpConfigurationProperties innerProperties; + + /** + * Get the name property: The IP configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The IP configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine scale set network profile's IP configuration + * properties. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetIpConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetIpConfiguration withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the subnet property: Specifies the identifier of the subnet. + * + * @return the subnet value. + */ + public ApiEntityReference subnet() { + return this.innerProperties() == null ? null : this.innerProperties().subnet(); + } + + /** + * Set the subnet property: Specifies the identifier of the subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withSubnet(ApiEntityReference subnet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withSubnet(subnet); + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressConfiguration(); + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withPublicIpAddressConfiguration( + VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withPublicIpAddressConfiguration(publicIpAddressConfiguration); + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersion privateIpAddressVersion() { + return this.innerProperties() == null ? null : this.innerProperties().privateIpAddressVersion(); + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withPrivateIpAddressVersion(IpVersion privateIpAddressVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withPrivateIpAddressVersion(privateIpAddressVersion); + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A scale set can reference backend address pools of multiple application gateways. + * Multiple scale sets cannot use the same application gateway. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().applicationGatewayBackendAddressPools(); + } + + /** + * Set the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application gateways. A scale set can reference backend address pools of multiple application gateways. + * Multiple scale sets cannot use the same application gateway. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withApplicationGatewayBackendAddressPools(applicationGatewayBackendAddressPools); + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.innerProperties() == null ? null : this.innerProperties().applicationSecurityGroups(); + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withApplicationSecurityGroups( + List applicationSecurityGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withApplicationSecurityGroups(applicationSecurityGroups); + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A scale set can reference backend address pools of one public and one internal load balancer. + * Multiple scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerBackendAddressPools(); + } + + /** + * Set the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A scale set can reference backend address pools of one public and one internal load balancer. + * Multiple scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withLoadBalancerBackendAddressPools(loadBalancerBackendAddressPools); + return this; + } + + /** + * Get the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple + * scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerInboundNatPools value. + */ + public List loadBalancerInboundNatPools() { + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerInboundNatPools(); + } + + /** + * Set the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple + * scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withLoadBalancerInboundNatPools( + List loadBalancerInboundNatPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetIpConfigurationProperties(); + } + this.innerProperties().withLoadBalancerInboundNatPools(loadBalancerInboundNatPools); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetIpConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpTag.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpTag.java new file mode 100644 index 0000000000000..91acf834f22d8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetIpTag.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the IP tag associated with the public IP address. */ +@Fluent +public final class VirtualMachineScaleSetIpTag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetIpTag.class); + + /* + * IP tag type. Example: FirstPartyUsage. + */ + @JsonProperty(value = "ipTagType") + private String ipTagType; + + /* + * IP tag associated with the public IP. Example: SQL, Storage etc. + */ + @JsonProperty(value = "tag") + private String tag; + + /** + * Get the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @return the ipTagType value. + */ + public String ipTagType() { + return this.ipTagType; + } + + /** + * Set the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @param ipTagType the ipTagType value to set. + * @return the VirtualMachineScaleSetIpTag object itself. + */ + public VirtualMachineScaleSetIpTag withIpTagType(String ipTagType) { + this.ipTagType = ipTagType; + return this; + } + + /** + * Get the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Set the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @param tag the tag value to set. + * @return the VirtualMachineScaleSetIpTag object itself. + */ + public VirtualMachineScaleSetIpTag withTag(String tag) { + this.tag = tag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListOSUpgradeHistory.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListOSUpgradeHistory.java new file mode 100644 index 0000000000000..798483eb81bbe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListOSUpgradeHistory.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.UpgradeOperationHistoricalStatusInfoInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Virtual Machine Scale Set OS Upgrade History operation response. */ +@Fluent +public final class VirtualMachineScaleSetListOSUpgradeHistory { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetListOSUpgradeHistory.class); + + /* + * The list of OS upgrades performed on the virtual machine scale set. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of OS Upgrade History. Call ListNext() + * with this to fetch the next page of history of upgrades. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of OS upgrades performed on the virtual machine scale set. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of OS upgrades performed on the virtual machine scale set. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetListOSUpgradeHistory object itself. + */ + public VirtualMachineScaleSetListOSUpgradeHistory withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to + * fetch the next page of history of upgrades. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to + * fetch the next page of history of upgrades. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetListOSUpgradeHistory object itself. + */ + public VirtualMachineScaleSetListOSUpgradeHistory withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetListOSUpgradeHistory")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListResult.java new file mode 100644 index 0000000000000..718cb4a300859 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine operation response. */ +@Fluent +public final class VirtualMachineScaleSetListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetListResult.class); + + /* + * The list of virtual machine scale sets. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Virtual Machine Scale Sets. Call + * ListNext() with this to fetch the next page of VMSS. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of virtual machine scale sets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machine scale sets. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetListResult object itself. + */ + public VirtualMachineScaleSetListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with + * this to fetch the next page of VMSS. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with + * this to fetch the next page of VMSS. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetListResult object itself. + */ + public VirtualMachineScaleSetListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListSkusResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListSkusResult.java new file mode 100644 index 0000000000000..036895a5f63bf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListSkusResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Virtual Machine Scale Set List Skus operation response. */ +@Fluent +public final class VirtualMachineScaleSetListSkusResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetListSkusResult.class); + + /* + * The list of skus available for the virtual machine scale set. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + * ListNext() with this to fetch the next page of VMSS Skus. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of skus available for the virtual machine scale set. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of skus available for the virtual machine scale set. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetListSkusResult object itself. + */ + public VirtualMachineScaleSetListSkusResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with + * this to fetch the next page of VMSS Skus. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with + * this to fetch the next page of VMSS Skus. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetListSkusResult object itself. + */ + public VirtualMachineScaleSetListSkusResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetListSkusResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListWithLinkResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListWithLinkResult.java new file mode 100644 index 0000000000000..94bd1d0cbe98e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetListWithLinkResult.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine operation response. */ +@Fluent +public final class VirtualMachineScaleSetListWithLinkResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetListWithLinkResult.class); + + /* + * The list of virtual machine scale sets. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Virtual Machine Scale Sets. Call + * ListNext() with this to fetch the next page of Virtual Machine Scale + * Sets. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of virtual machine scale sets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machine scale sets. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetListWithLinkResult object itself. + */ + public VirtualMachineScaleSetListWithLinkResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with + * this to fetch the next page of Virtual Machine Scale Sets. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with + * this to fetch the next page of Virtual Machine Scale Sets. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetListWithLinkResult object itself. + */ + public VirtualMachineScaleSetListWithLinkResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetListWithLinkResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetManagedDiskParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetManagedDiskParameters.java new file mode 100644 index 0000000000000..a16d0c8201763 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetManagedDiskParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the parameters of a ScaleSet managed disk. */ +@Fluent +public final class VirtualMachineScaleSetManagedDiskParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetManagedDiskParameters.class); + + /* + * Specifies the storage account type for the managed disk. NOTE: + * UltraSSD_LRS can only be used with data disks, it cannot be used with OS + * Disk. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountTypes storageAccountType; + + /* + * Specifies the customer managed disk encryption set resource id for the + * managed disk. + */ + @JsonProperty(value = "diskEncryptionSet") + private DiskEncryptionSetParameters diskEncryptionSet; + + /* + * Specifies the security profile for the managed disk. + */ + @JsonProperty(value = "securityProfile") + private VMDiskSecurityProfile securityProfile; + + /** + * Get the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @return the storageAccountType value. + */ + public StorageAccountTypes storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can only be used with data disks, it cannot be used with OS Disk. + * + * @param storageAccountType the storageAccountType value to set. + * @return the VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters withStorageAccountType(StorageAccountTypes storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed disk. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters withDiskEncryptionSet( + DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * 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 VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters withSecurityProfile(VMDiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfiguration.java new file mode 100644 index 0000000000000..3fb03a0b3ac70 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfiguration.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetNetworkConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's network configurations. */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfiguration extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetNetworkConfiguration.class); + + /* + * The network configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machine scale set network profile's IP + * configuration. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetNetworkConfigurationProperties innerProperties; + + /** + * Get the name property: The network configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The network configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine scale set network profile's IP configuration. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetNetworkConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetNetworkConfiguration withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more than 1 + * network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.innerProperties() == null ? null : this.innerProperties().enableAcceleratedNetworking(); + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withEnableAcceleratedNetworking(enableAcceleratedNetworking); + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.innerProperties() == null ? null : this.innerProperties().enableFpga(); + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withEnableFpga(Boolean enableFpga) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withEnableFpga(enableFpga); + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.innerProperties() == null ? null : this.innerProperties().networkSecurityGroup(); + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withNetworkSecurityGroup(SubResource networkSecurityGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withNetworkSecurityGroup(networkSecurityGroup); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withDnsSettings( + VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.innerProperties() == null ? null : this.innerProperties().ipConfigurations(); + } + + /** + * Set the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withIpConfigurations( + List ipConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withIpConfigurations(ipConfigurations); + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.innerProperties() == null ? null : this.innerProperties().enableIpForwarding(); + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withEnableIpForwarding(Boolean enableIpForwarding) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withEnableIpForwarding(enableIpForwarding); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetNetworkConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetNetworkConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java new file mode 100644 index 0000000000000..e91906183b261 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines scale sets network configuration's DNS settings. */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfigurationDnsSettings { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetNetworkConfigurationDnsSettings.class); + + /* + * List of DNS servers IP addresses + */ + @JsonProperty(value = "dnsServers") + private List dnsServers; + + /** + * Get the dnsServers property: List of DNS servers IP addresses. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: List of DNS servers IP addresses. + * + * @param dnsServers the dnsServers value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationDnsSettings object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkProfile.java new file mode 100644 index 0000000000000..f2360752545f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetNetworkProfile.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile. */ +@Fluent +public final class VirtualMachineScaleSetNetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetNetworkProfile.class); + + /* + * A reference to a load balancer probe used to determine the health of an + * instance in the virtual machine scale set. The reference will be in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + */ + @JsonProperty(value = "healthProbe") + private ApiEntityReference healthProbe; + + /* + * The list of network configurations. + */ + @JsonProperty(value = "networkInterfaceConfigurations") + private List networkInterfaceConfigurations; + + /* + * specifies the Microsoft.Network API version used when creating + * networking resources in the Network Interface Configurations for Virtual + * Machine Scale Set with orchestration mode 'Flexible' + */ + @JsonProperty(value = "networkApiVersion") + private NetworkApiVersion networkApiVersion; + + /** + * Get the healthProbe property: A reference to a load balancer probe used to determine the health of an instance in + * the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @return the healthProbe value. + */ + public ApiEntityReference healthProbe() { + return this.healthProbe; + } + + /** + * Set the healthProbe property: A reference to a load balancer probe used to determine the health of an instance in + * the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @param healthProbe the healthProbe value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withHealthProbe(ApiEntityReference healthProbe) { + this.healthProbe = healthProbe; + return this; + } + + /** + * Get the networkInterfaceConfigurations property: The list of network configurations. + * + * @return the networkInterfaceConfigurations value. + */ + public List networkInterfaceConfigurations() { + return this.networkInterfaceConfigurations; + } + + /** + * Set the networkInterfaceConfigurations property: The list of network configurations. + * + * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withNetworkInterfaceConfigurations( + List networkInterfaceConfigurations) { + this.networkInterfaceConfigurations = networkInterfaceConfigurations; + return this; + } + + /** + * Get the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode + * 'Flexible'. + * + * @return the networkApiVersion value. + */ + public NetworkApiVersion networkApiVersion() { + return this.networkApiVersion; + } + + /** + * Set the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode + * 'Flexible'. + * + * @param networkApiVersion the networkApiVersion value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withNetworkApiVersion(NetworkApiVersion networkApiVersion) { + this.networkApiVersion = networkApiVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (healthProbe() != null) { + healthProbe().validate(); + } + if (networkInterfaceConfigurations() != null) { + networkInterfaceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSDisk.java new file mode 100644 index 0000000000000..d281dbb462010 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSDisk.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set operating system disk. */ +@Fluent +public final class VirtualMachineScaleSetOSDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetOSDisk.class); + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the caching requirements.

    Possible values are: + *

    **None**

    **ReadOnly**

    **ReadWrite**

    + * Default: **None for Standard storage. ReadOnly for Premium storage** + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + */ + @JsonProperty(value = "writeAcceleratorEnabled") + private Boolean writeAcceleratorEnabled; + + /* + * Specifies how the virtual machines in the scale set should be + * created.

    The only allowed value is: **FromImage** \u2013 This + * value is used when you are using an image to create the virtual machine. + * If you are using a platform image, you also use the imageReference + * element described above. If you are using a marketplace image, you also + * use the plan element previously described. + */ + @JsonProperty(value = "createOption", required = true) + private DiskCreateOptionTypes createOption; + + /* + * Specifies the ephemeral disk Settings for the operating system disk used + * by the virtual machine scale set. + */ + @JsonProperty(value = "diffDiskSettings") + private DiffDiskSettings diffDiskSettings; + + /* + * Specifies the size of the operating system disk in gigabytes. This + * element can be used to overwrite the size of the disk in a virtual + * machine image.

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * 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** + */ + @JsonProperty(value = "osType") + private OperatingSystemTypes osType; + + /* + * Specifies information about the unmanaged user image to base the scale + * set on. + */ + @JsonProperty(value = "image") + private VirtualHardDisk image; + + /* + * Specifies the container urls that are used to store operating system + * disks for the scale set. + */ + @JsonProperty(value = "vhdContainers") + private List vhdContainers; + + /* + * The managed disk parameters. + */ + @JsonProperty(value = "managedDisk") + private VirtualMachineScaleSetManagedDiskParameters managedDisk; + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. <br><br> Possible values are: + * <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** + * <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. + * + * @param caching the caching value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the createOption property: Specifies how the virtual machines in the scale set should be + * created.<br><br> The only allowed value is: **FromImage** \u2013 This value is used when you are + * using an image to create the virtual machine. If you are using a platform image, you also use the imageReference + * element described above. If you are using a marketplace image, you also use the plan element previously + * described. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: Specifies how the virtual machines in the scale set should be + * created.<br><br> The only allowed value is: **FromImage** \u2013 This value is used when you are + * using an image to create the virtual machine. If you are using a platform image, you also use the imageReference + * element described above. If you are using a marketplace image, you also use the plan element previously + * described. + * + * @param createOption the createOption value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diffDiskSettings property: Specifies the ephemeral disk Settings for the operating system disk used by + * the virtual machine scale set. + * + * @return the diffDiskSettings value. + */ + public DiffDiskSettings diffDiskSettings() { + return this.diffDiskSettings; + } + + /** + * Set the diffDiskSettings property: Specifies the ephemeral disk Settings for the operating system disk used by + * the virtual machine scale set. + * + * @param diffDiskSettings the diffDiskSettings value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withDiffDiskSettings(DiffDiskSettings diffDiskSettings) { + this.diffDiskSettings = diffDiskSettings; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of the operating system disk in gigabytes. This element can be + * used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be + * larger than 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of the operating system disk in gigabytes. This element can be + * used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be + * larger than 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + 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. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **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. <br><br> Possible values are: + * <br><br> **Windows** <br><br> **Linux**. + * + * @param osType the osType value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the image property: Specifies information about the unmanaged user image to base the scale set on. + * + * @return the image value. + */ + public VirtualHardDisk image() { + return this.image; + } + + /** + * Set the image property: Specifies information about the unmanaged user image to base the scale set on. + * + * @param image the image value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withImage(VirtualHardDisk image) { + this.image = image; + return this; + } + + /** + * Get the vhdContainers property: Specifies the container urls that are used to store operating system disks for + * the scale set. + * + * @return the vhdContainers value. + */ + public List vhdContainers() { + return this.vhdContainers; + } + + /** + * Set the vhdContainers property: Specifies the container urls that are used to store operating system disks for + * the scale set. + * + * @param vhdContainers the vhdContainers value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withVhdContainers(List vhdContainers) { + this.vhdContainers = vhdContainers; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineScaleSetManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withManagedDisk(VirtualMachineScaleSetManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createOption() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property createOption in model VirtualMachineScaleSetOSDisk")); + } + if (diffDiskSettings() != null) { + diffDiskSettings().validate(); + } + if (image() != null) { + image().validate(); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSProfile.java new file mode 100644 index 0000000000000..bb6bf2be70d13 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetOSProfile.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set OS profile. */ +@Fluent +public final class VirtualMachineScaleSetOSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetOSProfile.class); + + /* + * Specifies the computer name prefix for all of the virtual machines in + * the scale set. Computer name prefixes must be 1 to 15 characters long. + */ + @JsonProperty(value = "computerNamePrefix") + private String computerNamePrefix; + + /* + * Specifies the name of the administrator account.

    **Windows-only + * restriction:** Cannot end in "."

    **Disallowed values:** + * "administrator", "admin", "user", "user1", "test", "user2", "test1", + * "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + * "aspnet", "backup", "console", "david", "guest", "john", "owner", + * "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + * "test3", "user4", "user5".

    **Minimum-length (Linux):** 1 + * character

    **Max-length (Linux):** 64 characters

    + * **Max-length (Windows):** 20 characters + */ + @JsonProperty(value = "adminUsername") + private String adminUsername; + + /* + * Specifies the password of the administrator account.

    + * **Minimum-length (Windows):** 8 characters

    **Minimum-length + * (Linux):** 6 characters

    **Max-length (Windows):** 123 + * characters

    **Max-length (Linux):** 72 characters

    + * **Complexity requirements:** 3 out of 4 conditions below need to be + * fulfilled
    Has lower characters
    Has upper characters
    Has a + * digit
    Has a special character (Regex match [\W_])

    + * **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", + * "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", + * "iloveyou!"

    For resetting the password, see [How to reset the + * Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + *

    For resetting root password, see [Manage users, SSH, and check + * or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + */ + @JsonProperty(value = "adminPassword") + private String adminPassword; + + /* + * Specifies a base-64 encoded string of custom data. The base-64 encoded + * string is decoded to a binary array that is saved as a file on the + * Virtual Machine. The maximum length of the binary array is 65535 bytes. + *

    For using cloud-init for your VM, see [Using cloud-init to + * customize a Linux VM during + * creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + */ + @JsonProperty(value = "customData") + private String customData; + + /* + * Specifies Windows operating system settings on the virtual machine. + */ + @JsonProperty(value = "windowsConfiguration") + private WindowsConfiguration windowsConfiguration; + + /* + * Specifies the Linux operating system settings on the virtual machine. + *

    For a list of supported Linux distributions, see [Linux on + * Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + */ + @JsonProperty(value = "linuxConfiguration") + private LinuxConfiguration linuxConfiguration; + + /* + * Specifies set of certificates that should be installed onto the virtual + * machines in the scale set. To install certificates on a virtual machine + * it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + @JsonProperty(value = "secrets") + private List secrets; + + /* + * Specifies whether extension operations should be allowed on the virtual + * machine scale set.

    This may only be set to False when no + * extensions are present on the virtual machine scale set. + */ + @JsonProperty(value = "allowExtensionOperations") + private Boolean allowExtensionOperations; + + /** + * Get the computerNamePrefix property: Specifies the computer name prefix for all of the virtual machines in the + * scale set. Computer name prefixes must be 1 to 15 characters long. + * + * @return the computerNamePrefix value. + */ + public String computerNamePrefix() { + return this.computerNamePrefix; + } + + /** + * Set the computerNamePrefix property: Specifies the computer name prefix for all of the virtual machines in the + * scale set. Computer name prefixes must be 1 to 15 characters long. + * + * @param computerNamePrefix the computerNamePrefix value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withComputerNamePrefix(String computerNamePrefix) { + this.computerNamePrefix = computerNamePrefix; + return this; + } + + /** + * Get the adminUsername property: Specifies the name of the administrator account. <br><br> + * **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", + * "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", + * "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", + * "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 + * character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length + * (Windows):** 20 characters. + * + * @return the adminUsername value. + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the adminUsername property: Specifies the name of the administrator account. <br><br> + * **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", + * "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", + * "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", + * "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 + * character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length + * (Windows):** 20 characters. + * + * @param adminUsername the adminUsername value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 + * characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled + * <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special + * character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> + * For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting + * root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 + * characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled + * <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special + * character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> + * For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows + * VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting + * root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess + * Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @param adminPassword the adminPassword value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string is + * decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array + * is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux + * VM during creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @return the customData value. + */ + public String customData() { + return this.customData; + } + + /** + * Set the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string is + * decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array + * is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux + * VM during creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @param customData the customData value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withCustomData(String customData) { + this.customData = customData; + return this; + } + + /** + * Get the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @return the windowsConfiguration value. + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. + * <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @return the linuxConfiguration value. + */ + public LinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. + * <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withLinuxConfiguration(LinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the secrets property: Specifies set of certificates that should be installed onto the virtual machines in the + * scale set. To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual + * machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the + * [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: Specifies set of certificates that should be installed onto the virtual machines in the + * scale set. To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual + * machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the + * [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param secrets the secrets value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Get the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine scale set. <br><br>This may only be set to False when no extensions are present on + * the virtual machine scale set. + * + * @return the allowExtensionOperations value. + */ + public Boolean allowExtensionOperations() { + return this.allowExtensionOperations; + } + + /** + * Set the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine scale set. <br><br>This may only be set to False when no extensions are present on + * the virtual machine scale set. + * + * @param allowExtensionOperations the allowExtensionOperations value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAllowExtensionOperations(Boolean allowExtensionOperations) { + this.allowExtensionOperations = allowExtensionOperations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (secrets() != null) { + secrets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java new file mode 100644 index 0000000000000..13b800f3b477b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetPublicIpAddressConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfiguration { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetPublicIpAddressConfiguration.class); + + /* + * The publicIP address configuration name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a virtual machines scale set IP Configuration's + * PublicIPAddress configuration + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetPublicIpAddressConfigurationProperties innerProperties; + + /* + * Describes the public IP Sku. It can only be set with OrchestrationMode + * as Flexible. + */ + @JsonProperty(value = "sku") + private PublicIpAddressSku sku; + + /** + * Get the name property: The publicIP address configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The publicIP address configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetPublicIpAddressConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + * + * @return the sku value. + */ + public PublicIpAddressSku sku() { + return this.sku; + } + + /** + * Set the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + * + * @param sku the sku value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withSku(PublicIpAddressSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().idleTimeoutInMinutes(); + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withIdleTimeoutInMinutes(Integer idleTimeoutInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withIdleTimeoutInMinutes(idleTimeoutInMinutes); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withDnsSettings( + VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the ipTags property: The list of IP tags associated with the public IP address. + * + * @return the ipTags value. + */ + public List ipTags() { + return this.innerProperties() == null ? null : this.innerProperties().ipTags(); + } + + /** + * Set the ipTags property: The list of IP tags associated with the public IP address. + * + * @param ipTags the ipTags value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withIpTags(List ipTags) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withIpTags(ipTags); + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpPrefix(); + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withPublicIpPrefix(SubResource publicIpPrefix) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpPrefix(publicIpPrefix); + return this; + } + + /** + * Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the publicIpAddressVersion value. + */ + public IpVersion publicIpAddressVersion() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressVersion(); + } + + /** + * Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param publicIpAddressVersion the publicIpAddressVersion value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withPublicIpAddressVersion( + IpVersion publicIpAddressVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpAddressVersion(publicIpAddressVersion); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetPublicIpAddressConfiguration")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java new file mode 100644 index 0000000000000..70d601ba04834 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machines scale sets network configuration's DNS settings. */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.class); + + /* + * The Domain name label.The concatenation of the domain name label and vm + * index will be the domain name labels of the PublicIPAddress resources + * that will be created + */ + @JsonProperty(value = "domainNameLabel", required = true) + private String domainNameLabel; + + /** + * Get the domainNameLabel property: The Domain name label.The concatenation of the domain name label and vm index + * will be the domain name labels of the PublicIPAddress resources that will be created. + * + * @return the domainNameLabel value. + */ + public String domainNameLabel() { + return this.domainNameLabel; + } + + /** + * Set the domainNameLabel property: The Domain name label.The concatenation of the domain name label and vm index + * will be the domain name labels of the PublicIPAddress resources that will be created. + * + * @param domainNameLabel the domainNameLabel value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings withDomainNameLabel(String domainNameLabel) { + this.domainNameLabel = domainNameLabel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (domainNameLabel() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property domainNameLabel in model" + + " VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetReimageParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetReimageParameters.java new file mode 100644 index 0000000000000..dd03066cd64ec --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetReimageParameters.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a Virtual Machine Scale Set VM Reimage Parameters. */ +@Fluent +public final class VirtualMachineScaleSetReimageParameters extends VirtualMachineScaleSetVMReimageParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetReimageParameters.class); + + /* + * The virtual machine scale set instance ids. Omitting the virtual machine + * scale set instance ids will result in the operation being performed on + * all virtual machines in the virtual machine scale set. + */ + @JsonProperty(value = "instanceIds") + private List instanceIds; + + /** + * Get the instanceIds property: The virtual machine scale set instance ids. Omitting the virtual machine scale set + * instance ids will result in the operation being performed on all virtual machines in the virtual machine scale + * set. + * + * @return the instanceIds value. + */ + public List instanceIds() { + return this.instanceIds; + } + + /** + * Set the instanceIds property: The virtual machine scale set instance ids. Omitting the virtual machine scale set + * instance ids will result in the operation being performed on all virtual machines in the virtual machine scale + * set. + * + * @param instanceIds the instanceIds value to set. + * @return the VirtualMachineScaleSetReimageParameters object itself. + */ + public VirtualMachineScaleSetReimageParameters withInstanceIds(List instanceIds) { + this.instanceIds = instanceIds; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetReimageParameters withTempDisk(Boolean tempDisk) { + super.withTempDisk(tempDisk); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetRollingUpgrades.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetRollingUpgrades.java new file mode 100644 index 0000000000000..eab1f87e60704 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetRollingUpgrades.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachineScaleSetRollingUpgrades. */ +public interface VirtualMachineScaleSetRollingUpgrades { + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String vmScaleSetName); + + /** + * Cancels the current virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startOSUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image + * OS version. Instances which are already running the latest available OS version are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startOSUpgrade(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startExtensionUpgrade(String resourceGroupName, String vmScaleSetName); + + /** + * Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest + * available extension version. Instances which are already running the latest extension versions are not affected. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startExtensionUpgrade(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade. + */ + RollingUpgradeStatusInfo getLatest(String resourceGroupName, String vmScaleSetName); + + /** + * Gets the status of the latest virtual machine scale set rolling upgrade. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the latest virtual machine scale set rolling upgrade along with {@link Response}. + */ + Response getLatestWithResponse( + String resourceGroupName, String vmScaleSetName, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetScaleInRules.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetScaleInRules.java new file mode 100644 index 0000000000000..444cb5a77291f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetScaleInRules.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualMachineScaleSetScaleInRules. */ +public final class VirtualMachineScaleSetScaleInRules extends ExpandableStringEnum { + /** Static value Default for VirtualMachineScaleSetScaleInRules. */ + public static final VirtualMachineScaleSetScaleInRules DEFAULT = fromString("Default"); + + /** Static value OldestVM for VirtualMachineScaleSetScaleInRules. */ + public static final VirtualMachineScaleSetScaleInRules OLDEST_VM = fromString("OldestVM"); + + /** Static value NewestVM for VirtualMachineScaleSetScaleInRules. */ + public static final VirtualMachineScaleSetScaleInRules NEWEST_VM = fromString("NewestVM"); + + /** + * Creates or finds a VirtualMachineScaleSetScaleInRules from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualMachineScaleSetScaleInRules. + */ + @JsonCreator + public static VirtualMachineScaleSetScaleInRules fromString(String name) { + return fromString(name, VirtualMachineScaleSetScaleInRules.class); + } + + /** @return known VirtualMachineScaleSetScaleInRules values. */ + public static Collection values() { + return values(VirtualMachineScaleSetScaleInRules.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSku.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSku.java new file mode 100644 index 0000000000000..55ac340af5430 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSku.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner; + +/** An immutable client-side representation of VirtualMachineScaleSetSku. */ +public interface VirtualMachineScaleSetSku { + /** + * Gets the resourceType property: The type of resource the sku applies to. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the sku property: The Sku. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the capacity property: Specifies the number of virtual machines in the scale set. + * + * @return the capacity value. + */ + VirtualMachineScaleSetSkuCapacity capacity(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetSkuInner object. + * + * @return the inner object. + */ + VirtualMachineScaleSetSkuInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuCapacity.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuCapacity.java new file mode 100644 index 0000000000000..3e89c712e4565 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuCapacity.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes scaling information of a sku. */ +@Immutable +public final class VirtualMachineScaleSetSkuCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetSkuCapacity.class); + + /* + * The minimum capacity. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Long minimum; + + /* + * The maximum capacity that can be set. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Long maximum; + + /* + * The default capacity. + */ + @JsonProperty(value = "defaultCapacity", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultCapacity; + + /* + * The scale type applicable to the sku. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineScaleSetSkuScaleType scaleType; + + /** + * Get the minimum property: The minimum capacity. + * + * @return the minimum value. + */ + public Long minimum() { + return this.minimum; + } + + /** + * Get the maximum property: The maximum capacity that can be set. + * + * @return the maximum value. + */ + public Long maximum() { + return this.maximum; + } + + /** + * Get the defaultCapacity property: The default capacity. + * + * @return the defaultCapacity value. + */ + public Long defaultCapacity() { + return this.defaultCapacity; + } + + /** + * Get the scaleType property: The scale type applicable to the sku. + * + * @return the scaleType value. + */ + public VirtualMachineScaleSetSkuScaleType scaleType() { + return this.scaleType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuScaleType.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuScaleType.java new file mode 100644 index 0000000000000..a52c420771749 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetSkuScaleType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for VirtualMachineScaleSetSkuScaleType. */ +public enum VirtualMachineScaleSetSkuScaleType { + /** Enum value Automatic. */ + AUTOMATIC("Automatic"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a VirtualMachineScaleSetSkuScaleType instance. */ + private final String value; + + VirtualMachineScaleSetSkuScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a VirtualMachineScaleSetSkuScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed VirtualMachineScaleSetSkuScaleType object, or null if unable to parse. + */ + @JsonCreator + public static VirtualMachineScaleSetSkuScaleType fromString(String value) { + VirtualMachineScaleSetSkuScaleType[] items = VirtualMachineScaleSetSkuScaleType.values(); + for (VirtualMachineScaleSetSkuScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetStorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetStorageProfile.java new file mode 100644 index 0000000000000..69b6b027ffd60 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetStorageProfile.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set storage profile. */ +@Fluent +public final class VirtualMachineScaleSetStorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetStorageProfile.class); + + /* + * Specifies information about the image to use. You can specify + * information about platform images, marketplace images, or virtual + * machine images. This element is required when you want to use a platform + * image, marketplace image, or virtual machine image, but is not used in + * other creation operations. + */ + @JsonProperty(value = "imageReference") + private ImageReference imageReference; + + /* + * Specifies information about the operating system disk used by the + * virtual machines in the scale set.

    For more information about + * disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "osDisk") + private VirtualMachineScaleSetOSDisk osDisk; + + /* + * Specifies the parameters that are used to add data disks to the virtual + * machines in the scale set.

    For more information about disks, + * see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is required when you want to use a + * platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is required when you want to use a + * platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + * + * @param imageReference the imageReference value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the osDisk property: Specifies information about the operating system disk used by the virtual machines in + * the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the osDisk value. + */ + public VirtualMachineScaleSetOSDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: Specifies information about the operating system disk used by the virtual machines in + * the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param osDisk the osDisk value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withOsDisk(VirtualMachineScaleSetOSDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: Specifies the parameters that are used to add data disks to the virtual machines in + * the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Specifies the parameters that are used to add data disks to the virtual machines in + * the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param dataDisks the dataDisks value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdate.java new file mode 100644 index 0000000000000..1c0ca28a741f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdate.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Virtual Machine Scale Set. */ +@Fluent +public final class VirtualMachineScaleSetUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdate.class); + + /* + * The virtual machine scale set sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The purchase plan when deploying a virtual machine scale set from VM + * Marketplace images. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * Describes the properties of a Virtual Machine Scale Set. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetUpdateProperties innerProperties; + + /* + * The identity of the virtual machine scale set, if configured. + */ + @JsonProperty(value = "identity") + private VirtualMachineScaleSetIdentity identity; + + /** + * Get the sku property: The virtual machine scale set sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The virtual machine scale set sku. + * + * @param sku the sku value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the plan property: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + * + * @param plan the plan value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the innerProperties property: Describes the properties of a Virtual Machine Scale Set. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The identity of the virtual machine scale set, if configured. + * + * @return the identity value. + */ + public VirtualMachineScaleSetIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the virtual machine scale set, if configured. + * + * @param identity the identity value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withIdentity(VirtualMachineScaleSetIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the upgradePolicy property: The upgrade policy. + * + * @return the upgradePolicy value. + */ + public UpgradePolicy upgradePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().upgradePolicy(); + } + + /** + * Set the upgradePolicy property: The upgrade policy. + * + * @param upgradePolicy the upgradePolicy value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withUpgradePolicy(UpgradePolicy upgradePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withUpgradePolicy(upgradePolicy); + return this; + } + + /** + * Get the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @return the automaticRepairsPolicy value. + */ + public AutomaticRepairsPolicy automaticRepairsPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().automaticRepairsPolicy(); + } + + /** + * Set the automaticRepairsPolicy property: Policy for automatic repairs. + * + * @param automaticRepairsPolicy the automaticRepairsPolicy value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withAutomaticRepairsPolicy(AutomaticRepairsPolicy automaticRepairsPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withAutomaticRepairsPolicy(automaticRepairsPolicy); + return this; + } + + /** + * Get the virtualMachineProfile property: The virtual machine profile. + * + * @return the virtualMachineProfile value. + */ + public VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile() { + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineProfile(); + } + + /** + * Set the virtualMachineProfile property: The virtual machine profile. + * + * @param virtualMachineProfile the virtualMachineProfile value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withVirtualMachineProfile( + VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withVirtualMachineProfile(virtualMachineProfile); + return this; + } + + /** + * Get the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @return the overprovision value. + */ + public Boolean overprovision() { + return this.innerProperties() == null ? null : this.innerProperties().overprovision(); + } + + /** + * Set the overprovision property: Specifies whether the Virtual Machine Scale Set should be overprovisioned. + * + * @param overprovision the overprovision value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withOverprovision(Boolean overprovision) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withOverprovision(overprovision); + return this; + } + + /** + * Get the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @return the doNotRunExtensionsOnOverprovisionedVMs value. + */ + public Boolean doNotRunExtensionsOnOverprovisionedVMs() { + return this.innerProperties() == null ? null : this.innerProperties().doNotRunExtensionsOnOverprovisionedVMs(); + } + + /** + * Set the doNotRunExtensionsOnOverprovisionedVMs property: When Overprovision is enabled, extensions are launched + * only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions + * do not run on the extra overprovisioned VMs. + * + * @param doNotRunExtensionsOnOverprovisionedVMs the doNotRunExtensionsOnOverprovisionedVMs value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withDoNotRunExtensionsOnOverprovisionedVMs( + Boolean doNotRunExtensionsOnOverprovisionedVMs) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withDoNotRunExtensionsOnOverprovisionedVMs(doNotRunExtensionsOnOverprovisionedVMs); + return this; + } + + /** + * Get the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @return the singlePlacementGroup value. + */ + public Boolean singlePlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().singlePlacementGroup(); + } + + /** + * Set the singlePlacementGroup property: When true this limits the scale set to a single placement group, of max + * size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if + * singlePlacementGroup is false, it may not be modified to true. + * + * @param singlePlacementGroup the singlePlacementGroup value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withSinglePlacementGroup(Boolean singlePlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withSinglePlacementGroup(singlePlacementGroup); + return this; + } + + /** + * Get the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + public AdditionalCapabilities additionalCapabilities() { + return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities(); + } + + /** + * Set the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the Virtual + * Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to + * support attaching managed data disks with UltraSSD_LRS storage account type. + * + * @param additionalCapabilities the additionalCapabilities value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withAdditionalCapabilities(AdditionalCapabilities additionalCapabilities) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withAdditionalCapabilities(additionalCapabilities); + return this; + } + + /** + * Get the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @return the scaleInPolicy value. + */ + public ScaleInPolicy scaleInPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().scaleInPolicy(); + } + + /** + * Set the scaleInPolicy property: Specifies the policies applied when scaling in Virtual Machines in the Virtual + * Machine Scale Set. + * + * @param scaleInPolicy the scaleInPolicy value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withScaleInPolicy(ScaleInPolicy scaleInPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withScaleInPolicy(scaleInPolicy); + return this; + } + + /** + * Get the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + public SubResource proximityPlacementGroup() { + return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup(); + } + + /** + * Set the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @param proximityPlacementGroup the proximityPlacementGroup value to set. + * @return the VirtualMachineScaleSetUpdate object itself. + */ + public VirtualMachineScaleSetUpdate withProximityPlacementGroup(SubResource proximityPlacementGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateProperties(); + } + this.innerProperties().withProximityPlacementGroup(proximityPlacementGroup); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sku() != null) { + sku().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateIpConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateIpConfiguration.java new file mode 100644 index 0000000000000..864f9956465fa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateIpConfiguration.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetUpdateIpConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be + * modified as long as the original subnet and the new subnet are in the same virtual network. + */ +@Fluent +public final class VirtualMachineScaleSetUpdateIpConfiguration extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateIpConfiguration.class); + + /* + * The IP configuration name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Describes a virtual machine scale set network profile's IP configuration + * properties. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetUpdateIpConfigurationProperties innerProperties; + + /** + * Get the name property: The IP configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The IP configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine scale set network profile's IP configuration + * properties. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetUpdateIpConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetUpdateIpConfiguration withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the subnet property: The subnet. + * + * @return the subnet value. + */ + public ApiEntityReference subnet() { + return this.innerProperties() == null ? null : this.innerProperties().subnet(); + } + + /** + * Set the subnet property: The subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withSubnet(ApiEntityReference subnet) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withSubnet(subnet); + return this; + } + + /** + * Get the primary property: Specifies the primary IP Configuration in case the network interface has more than one + * IP Configuration. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Specifies the primary IP Configuration in case the network interface has more than one + * IP Configuration. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressConfiguration(); + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withPublicIpAddressConfiguration( + VirtualMachineScaleSetUpdatePublicIpAddressConfiguration publicIpAddressConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withPublicIpAddressConfiguration(publicIpAddressConfiguration); + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersion privateIpAddressVersion() { + return this.innerProperties() == null ? null : this.innerProperties().privateIpAddressVersion(); + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withPrivateIpAddressVersion(IpVersion privateIpAddressVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withPrivateIpAddressVersion(privateIpAddressVersion); + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: The application gateway backend address pools. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().applicationGatewayBackendAddressPools(); + } + + /** + * Set the applicationGatewayBackendAddressPools property: The application gateway backend address pools. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withApplicationGatewayBackendAddressPools( + List applicationGatewayBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withApplicationGatewayBackendAddressPools(applicationGatewayBackendAddressPools); + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.innerProperties() == null ? null : this.innerProperties().applicationSecurityGroups(); + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withApplicationSecurityGroups( + List applicationSecurityGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withApplicationSecurityGroups(applicationSecurityGroups); + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: The load balancer backend address pools. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerBackendAddressPools(); + } + + /** + * Set the loadBalancerBackendAddressPools property: The load balancer backend address pools. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withLoadBalancerBackendAddressPools( + List loadBalancerBackendAddressPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withLoadBalancerBackendAddressPools(loadBalancerBackendAddressPools); + return this; + } + + /** + * Get the loadBalancerInboundNatPools property: The load balancer inbound nat pools. + * + * @return the loadBalancerInboundNatPools value. + */ + public List loadBalancerInboundNatPools() { + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerInboundNatPools(); + } + + /** + * Set the loadBalancerInboundNatPools property: The load balancer inbound nat pools. + * + * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set. + * @return the VirtualMachineScaleSetUpdateIpConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateIpConfiguration withLoadBalancerInboundNatPools( + List loadBalancerInboundNatPools) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateIpConfigurationProperties(); + } + this.innerProperties().withLoadBalancerInboundNatPools(loadBalancerInboundNatPools); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkConfiguration.java new file mode 100644 index 0000000000000..98a1036d5bf61 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkConfiguration.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetUpdateNetworkConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile's network configurations. */ +@Fluent +public final class VirtualMachineScaleSetUpdateNetworkConfiguration extends SubResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateNetworkConfiguration.class); + + /* + * The network configuration name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Describes a virtual machine scale set updatable network profile's IP + * configuration.Use this object for updating network profile's IP + * Configuration. + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetUpdateNetworkConfigurationProperties innerProperties; + + /** + * Get the name property: The network configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The network configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machine scale set updatable network profile's IP + * configuration.Use this object for updating network profile's IP Configuration. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetUpdateNetworkConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetUpdateNetworkConfiguration withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the primary property: Whether this is a primary NIC on a virtual machine. + * + * @return the primary value. + */ + public Boolean primary() { + return this.innerProperties() == null ? null : this.innerProperties().primary(); + } + + /** + * Set the primary property: Whether this is a primary NIC on a virtual machine. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withPrimary(Boolean primary) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withPrimary(primary); + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.innerProperties() == null ? null : this.innerProperties().enableAcceleratedNetworking(); + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withEnableAcceleratedNetworking( + Boolean enableAcceleratedNetworking) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withEnableAcceleratedNetworking(enableAcceleratedNetworking); + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.innerProperties() == null ? null : this.innerProperties().enableFpga(); + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withEnableFpga(Boolean enableFpga) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withEnableFpga(enableFpga); + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.innerProperties() == null ? null : this.innerProperties().networkSecurityGroup(); + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withNetworkSecurityGroup(SubResource networkSecurityGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withNetworkSecurityGroup(networkSecurityGroup); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withDnsSettings( + VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the ipConfigurations property: The virtual machine scale set IP Configuration. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.innerProperties() == null ? null : this.innerProperties().ipConfigurations(); + } + + /** + * Set the ipConfigurations property: The virtual machine scale set IP Configuration. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withIpConfigurations( + List ipConfigurations) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withIpConfigurations(ipConfigurations); + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.innerProperties() == null ? null : this.innerProperties().enableIpForwarding(); + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withEnableIpForwarding(Boolean enableIpForwarding) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withEnableIpForwarding(enableIpForwarding); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetUpdateNetworkConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdateNetworkConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkProfile.java new file mode 100644 index 0000000000000..83067e4471041 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateNetworkProfile.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set network profile. */ +@Fluent +public final class VirtualMachineScaleSetUpdateNetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateNetworkProfile.class); + + /* + * A reference to a load balancer probe used to determine the health of an + * instance in the virtual machine scale set. The reference will be in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + */ + @JsonProperty(value = "healthProbe") + private ApiEntityReference healthProbe; + + /* + * The list of network configurations. + */ + @JsonProperty(value = "networkInterfaceConfigurations") + private List networkInterfaceConfigurations; + + /* + * specifies the Microsoft.Network API version used when creating + * networking resources in the Network Interface Configurations for Virtual + * Machine Scale Set with orchestration mode 'Flexible' + */ + @JsonProperty(value = "networkApiVersion") + private NetworkApiVersion networkApiVersion; + + /** + * Get the healthProbe property: A reference to a load balancer probe used to determine the health of an instance in + * the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @return the healthProbe value. + */ + public ApiEntityReference healthProbe() { + return this.healthProbe; + } + + /** + * Set the healthProbe property: A reference to a load balancer probe used to determine the health of an instance in + * the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @param healthProbe the healthProbe value to set. + * @return the VirtualMachineScaleSetUpdateNetworkProfile object itself. + */ + public VirtualMachineScaleSetUpdateNetworkProfile withHealthProbe(ApiEntityReference healthProbe) { + this.healthProbe = healthProbe; + return this; + } + + /** + * Get the networkInterfaceConfigurations property: The list of network configurations. + * + * @return the networkInterfaceConfigurations value. + */ + public List networkInterfaceConfigurations() { + return this.networkInterfaceConfigurations; + } + + /** + * Set the networkInterfaceConfigurations property: The list of network configurations. + * + * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set. + * @return the VirtualMachineScaleSetUpdateNetworkProfile object itself. + */ + public VirtualMachineScaleSetUpdateNetworkProfile withNetworkInterfaceConfigurations( + List networkInterfaceConfigurations) { + this.networkInterfaceConfigurations = networkInterfaceConfigurations; + return this; + } + + /** + * Get the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode + * 'Flexible'. + * + * @return the networkApiVersion value. + */ + public NetworkApiVersion networkApiVersion() { + return this.networkApiVersion; + } + + /** + * Set the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode + * 'Flexible'. + * + * @param networkApiVersion the networkApiVersion value to set. + * @return the VirtualMachineScaleSetUpdateNetworkProfile object itself. + */ + public VirtualMachineScaleSetUpdateNetworkProfile withNetworkApiVersion(NetworkApiVersion networkApiVersion) { + this.networkApiVersion = networkApiVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (healthProbe() != null) { + healthProbe().validate(); + } + if (networkInterfaceConfigurations() != null) { + networkInterfaceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSDisk.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSDisk.java new file mode 100644 index 0000000000000..a34e56c26f841 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSDisk.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes virtual machine scale set operating system disk Update Object. This should be used for Updating VMSS OS + * Disk. + */ +@Fluent +public final class VirtualMachineScaleSetUpdateOSDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateOSDisk.class); + + /* + * The caching type. + */ + @JsonProperty(value = "caching") + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + */ + @JsonProperty(value = "writeAcceleratorEnabled") + private Boolean writeAcceleratorEnabled; + + /* + * Specifies the size of the operating system disk in gigabytes. This + * element can be used to overwrite the size of the disk in a virtual + * machine image.

    This value cannot be larger than 1023 GB + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * The Source User Image VirtualHardDisk. This VirtualHardDisk will be + * copied before using it to attach to the Virtual Machine. If SourceImage + * is provided, the destination VirtualHardDisk should not exist. + */ + @JsonProperty(value = "image") + private VirtualHardDisk image; + + /* + * The list of virtual hard disk container uris. + */ + @JsonProperty(value = "vhdContainers") + private List vhdContainers; + + /* + * The managed disk parameters. + */ + @JsonProperty(value = "managedDisk") + private VirtualMachineScaleSetManagedDiskParameters managedDisk; + + /** + * Get the caching property: The caching type. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: The caching type. + * + * @param caching the caching value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of the operating system disk in gigabytes. This element can be + * used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be + * larger than 1023 GB. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of the operating system disk in gigabytes. This element can be + * used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be + * larger than 1023 GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the image property: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using + * it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not + * exist. + * + * @return the image value. + */ + public VirtualHardDisk image() { + return this.image; + } + + /** + * Set the image property: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using + * it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not + * exist. + * + * @param image the image value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withImage(VirtualHardDisk image) { + this.image = image; + return this; + } + + /** + * Get the vhdContainers property: The list of virtual hard disk container uris. + * + * @return the vhdContainers value. + */ + public List vhdContainers() { + return this.vhdContainers; + } + + /** + * Set the vhdContainers property: The list of virtual hard disk container uris. + * + * @param vhdContainers the vhdContainers value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withVhdContainers(List vhdContainers) { + this.vhdContainers = vhdContainers; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineScaleSetManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineScaleSetUpdateOSDisk object itself. + */ + public VirtualMachineScaleSetUpdateOSDisk withManagedDisk(VirtualMachineScaleSetManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (image() != null) { + image().validate(); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSProfile.java new file mode 100644 index 0000000000000..5fdc8351e7d14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateOSProfile.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set OS profile. */ +@Fluent +public final class VirtualMachineScaleSetUpdateOSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateOSProfile.class); + + /* + * A base-64 encoded string of custom data. + */ + @JsonProperty(value = "customData") + private String customData; + + /* + * The Windows Configuration of the OS profile. + */ + @JsonProperty(value = "windowsConfiguration") + private WindowsConfiguration windowsConfiguration; + + /* + * The Linux Configuration of the OS profile. + */ + @JsonProperty(value = "linuxConfiguration") + private LinuxConfiguration linuxConfiguration; + + /* + * The List of certificates for addition to the VM. + */ + @JsonProperty(value = "secrets") + private List secrets; + + /** + * Get the customData property: A base-64 encoded string of custom data. + * + * @return the customData value. + */ + public String customData() { + return this.customData; + } + + /** + * Set the customData property: A base-64 encoded string of custom data. + * + * @param customData the customData value to set. + * @return the VirtualMachineScaleSetUpdateOSProfile object itself. + */ + public VirtualMachineScaleSetUpdateOSProfile withCustomData(String customData) { + this.customData = customData; + return this; + } + + /** + * Get the windowsConfiguration property: The Windows Configuration of the OS profile. + * + * @return the windowsConfiguration value. + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: The Windows Configuration of the OS profile. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the VirtualMachineScaleSetUpdateOSProfile object itself. + */ + public VirtualMachineScaleSetUpdateOSProfile withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the linuxConfiguration property: The Linux Configuration of the OS profile. + * + * @return the linuxConfiguration value. + */ + public LinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: The Linux Configuration of the OS profile. + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the VirtualMachineScaleSetUpdateOSProfile object itself. + */ + public VirtualMachineScaleSetUpdateOSProfile withLinuxConfiguration(LinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the secrets property: The List of certificates for addition to the VM. + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: The List of certificates for addition to the VM. + * + * @param secrets the secrets value to set. + * @return the VirtualMachineScaleSetUpdateOSProfile object itself. + */ + public VirtualMachineScaleSetUpdateOSProfile withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (secrets() != null) { + secrets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdatePublicIpAddressConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdatePublicIpAddressConfiguration.java new file mode 100644 index 0000000000000..426b41ea6272e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdatePublicIpAddressConfiguration.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. */ +@Fluent +public final class VirtualMachineScaleSetUpdatePublicIpAddressConfiguration { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(VirtualMachineScaleSetUpdatePublicIpAddressConfiguration.class); + + /* + * The publicIP address configuration name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Describes a virtual machines scale set IP Configuration's + * PublicIPAddress configuration + */ + @JsonProperty(value = "properties") + private VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties innerProperties; + + /** + * Get the name property: The publicIP address configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The publicIP address configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + * + * @return the innerProperties value. + */ + private VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().idleTimeoutInMinutes(); + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration withIdleTimeoutInMinutes( + Integer idleTimeoutInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withIdleTimeoutInMinutes(idleTimeoutInMinutes); + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings() { + return this.innerProperties() == null ? null : this.innerProperties().dnsSettings(); + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration withDnsSettings( + VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDnsSettings(dnsSettings); + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.innerProperties() == null ? null : this.innerProperties().publicIpPrefix(); + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration withPublicIpPrefix(SubResource publicIpPrefix) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withPublicIpPrefix(publicIpPrefix); + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.innerProperties() == null ? null : this.innerProperties().deleteOption(); + } + + /** + * Set the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetUpdatePublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetUpdatePublicIpAddressConfiguration withDeleteOption(DeleteOptions deleteOption) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineScaleSetUpdatePublicIpAddressConfigurationProperties(); + } + this.innerProperties().withDeleteOption(deleteOption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateStorageProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateStorageProfile.java new file mode 100644 index 0000000000000..43573f1361d3f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateStorageProfile.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set storage profile. */ +@Fluent +public final class VirtualMachineScaleSetUpdateStorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateStorageProfile.class); + + /* + * The image reference. + */ + @JsonProperty(value = "imageReference") + private ImageReference imageReference; + + /* + * The OS disk. + */ + @JsonProperty(value = "osDisk") + private VirtualMachineScaleSetUpdateOSDisk osDisk; + + /* + * The data disks. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get the imageReference property: The image reference. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: The image reference. + * + * @param imageReference the imageReference value to set. + * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. + */ + public VirtualMachineScaleSetUpdateStorageProfile withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the osDisk property: The OS disk. + * + * @return the osDisk value. + */ + public VirtualMachineScaleSetUpdateOSDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: The OS disk. + * + * @param osDisk the osDisk value to set. + * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. + */ + public VirtualMachineScaleSetUpdateStorageProfile withOsDisk(VirtualMachineScaleSetUpdateOSDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: The data disks. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: The data disks. + * + * @param dataDisks the dataDisks value to set. + * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. + */ + public VirtualMachineScaleSetUpdateStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateVMProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateVMProfile.java new file mode 100644 index 0000000000000..9788d7e1bcf21 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetUpdateVMProfile.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machine scale set virtual machine profile. */ +@Fluent +public final class VirtualMachineScaleSetUpdateVMProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetUpdateVMProfile.class); + + /* + * The virtual machine scale set OS profile. + */ + @JsonProperty(value = "osProfile") + private VirtualMachineScaleSetUpdateOSProfile osProfile; + + /* + * The virtual machine scale set storage profile. + */ + @JsonProperty(value = "storageProfile") + private VirtualMachineScaleSetUpdateStorageProfile storageProfile; + + /* + * The virtual machine scale set network profile. + */ + @JsonProperty(value = "networkProfile") + private VirtualMachineScaleSetUpdateNetworkProfile networkProfile; + + /* + * The virtual machine scale set Security profile + */ + @JsonProperty(value = "securityProfile") + private SecurityProfile securityProfile; + + /* + * The virtual machine scale set diagnostics profile. + */ + @JsonProperty(value = "diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /* + * The virtual machine scale set extension profile. + */ + @JsonProperty(value = "extensionProfile") + private VirtualMachineScaleSetExtensionProfile extensionProfile; + + /* + * The license type, which is for bring your own license scenario. + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * Specifies the billing related details of a Azure Spot VMSS. + *

    Minimum api-version: 2019-03-01. + */ + @JsonProperty(value = "billingProfile") + private BillingProfile billingProfile; + + /* + * Specifies Scheduled Event related configurations. + */ + @JsonProperty(value = "scheduledEventsProfile") + private ScheduledEventsProfile scheduledEventsProfile; + + /* + * UserData for the VM, which must be base-64 encoded. Customer should not + * pass any secrets in here.

    Minimum api-version: 2021-03-01 + */ + @JsonProperty(value = "userData") + private String userData; + + /** + * Get the osProfile property: The virtual machine scale set OS profile. + * + * @return the osProfile value. + */ + public VirtualMachineScaleSetUpdateOSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: The virtual machine scale set OS profile. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withOsProfile(VirtualMachineScaleSetUpdateOSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the storageProfile property: The virtual machine scale set storage profile. + * + * @return the storageProfile value. + */ + public VirtualMachineScaleSetUpdateStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: The virtual machine scale set storage profile. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withStorageProfile( + VirtualMachineScaleSetUpdateStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the networkProfile property: The virtual machine scale set network profile. + * + * @return the networkProfile value. + */ + public VirtualMachineScaleSetUpdateNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: The virtual machine scale set network profile. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withNetworkProfile( + VirtualMachineScaleSetUpdateNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the securityProfile property: The virtual machine scale set Security profile. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: The virtual machine scale set Security profile. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the diagnosticsProfile property: The virtual machine scale set diagnostics profile. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: The virtual machine scale set diagnostics profile. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the extensionProfile property: The virtual machine scale set extension profile. + * + * @return the extensionProfile value. + */ + public VirtualMachineScaleSetExtensionProfile extensionProfile() { + return this.extensionProfile; + } + + /** + * Set the extensionProfile property: The virtual machine scale set extension profile. + * + * @param extensionProfile the extensionProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withExtensionProfile( + VirtualMachineScaleSetExtensionProfile extensionProfile) { + this.extensionProfile = extensionProfile; + return this; + } + + /** + * Get the licenseType property: The license type, which is for bring your own license scenario. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type, which is for bring your own license scenario. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the billingProfile property: Specifies the billing related details of a Azure Spot VMSS. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + public BillingProfile billingProfile() { + return this.billingProfile; + } + + /** + * Set the billingProfile property: Specifies the billing related details of a Azure Spot VMSS. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param billingProfile the billingProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withBillingProfile(BillingProfile billingProfile) { + this.billingProfile = billingProfile; + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.scheduledEventsProfile; + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withScheduledEventsProfile( + ScheduledEventsProfile scheduledEventsProfile) { + this.scheduledEventsProfile = scheduledEventsProfile; + return this; + } + + /** + * Get the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.userData; + } + + /** + * Set the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineScaleSetUpdateVMProfile object itself. + */ + public VirtualMachineScaleSetUpdateVMProfile withUserData(String userData) { + this.userData = userData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osProfile() != null) { + osProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (extensionProfile() != null) { + extensionProfile().validate(); + } + if (billingProfile() != null) { + billingProfile().validate(); + } + if (scheduledEventsProfile() != null) { + scheduledEventsProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVM.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVM.java new file mode 100644 index 0000000000000..278f06de5a3aa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVM.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineScaleSetVM. */ +public interface VirtualMachineScaleSetVM { + /** + * 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 instanceId property: The virtual machine instance ID. + * + * @return the instanceId value. + */ + String instanceId(); + + /** + * Gets the sku property: The virtual machine SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Specifies information about the marketplace image used to create the virtual machine. + * This element is only used for marketplace images. Before you can use a marketplace image from an API, you must + * enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and + * then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the resources property: The virtual machine child extension resources. + * + * @return the resources value. + */ + List resources(); + + /** + * Gets the zones property: The virtual machine zones. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the latestModelApplied property: Specifies whether the latest model has been applied to the virtual machine. + * + * @return the latestModelApplied value. + */ + Boolean latestModelApplied(); + + /** + * Gets the vmId property: Azure VM unique ID. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + VirtualMachineScaleSetVMInstanceView instanceView(); + + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + SecurityProfile securityProfile(); + + /** + * Gets the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the networkProfileConfiguration property: Specifies the network profile configuration of the virtual + * machine. + * + * @return the networkProfileConfiguration value. + */ + VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration(); + + /** + * Gets the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + DiagnosticsProfile diagnosticsProfile(); + + /** + * Gets the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @return the availabilitySet value. + */ + SubResource availabilitySet(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + String licenseType(); + + /** + * Gets the modelDefinitionApplied property: Specifies whether the model applied to the virtual machine is the model + * of the virtual machine scale set or the customized model for the virtual machine. + * + * @return the modelDefinitionApplied value. + */ + String modelDefinitionApplied(); + + /** + * Gets the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @return the protectionPolicy value. + */ + VirtualMachineScaleSetVMProtectionPolicy protectionPolicy(); + + /** + * Gets the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + String userData(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner object. + * + * @return the inner object. + */ + VirtualMachineScaleSetVMInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtension.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtension.java new file mode 100644 index 0000000000000..cfa461959327c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtension.java @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner; + +/** An immutable client-side representation of VirtualMachineScaleSetVMExtension. */ +public interface VirtualMachineScaleSetVMExtension { + /** + * Gets the id property: Resource Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the extension. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + String typeHandlerVersion(); + + /** + * Gets the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if + * one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + Boolean enableAutomaticUpgrade(); + + /** + * Gets the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + Object settings(); + + /** + * Gets the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + Object protectedSettings(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine extension instance view. + * + * @return the instanceView value. + */ + VirtualMachineExtensionInstanceView instanceView(); + + /** + * Gets the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + Boolean suppressFailures(); + + /** + * Gets the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + Object protectedSettingsFromKeyVault(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionInner + * object. + * + * @return the inner object. + */ + VirtualMachineScaleSetVMExtensionInner innerModel(); + + /** The entirety of the VirtualMachineScaleSetVMExtension definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualMachineScaleSetVMExtension definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineScaleSetVMExtension definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vmScaleSetName, instanceId. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String vmScaleSetName, String instanceId); + } + /** + * The stage of the VirtualMachineScaleSetVMExtension 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.WithForceUpdateTag, + DefinitionStages.WithPublisher, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithTypeHandlerVersion, + DefinitionStages.WithAutoUpgradeMinorVersion, + DefinitionStages.WithEnableAutomaticUpgrade, + DefinitionStages.WithSettings, + DefinitionStages.WithProtectedSettings, + DefinitionStages.WithInstanceView, + DefinitionStages.WithSuppressFailures, + DefinitionStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineScaleSetVMExtension create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineScaleSetVMExtension create(Context context); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + WithCreate withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + WithCreate withPublisher(String publisher); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(String typePropertiesType); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + WithCreate withTypeHandlerVersion(String typeHandlerVersion); + } + /** + * The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify autoUpgradeMinorVersion. + */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + WithCreate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + WithCreate withSettings(Object settings); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + WithCreate withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify instanceView. */ + interface WithInstanceView { + /** + * Specifies the instanceView property: The virtual machine extension instance view.. + * + * @param instanceView The virtual machine extension instance view. + * @return the next definition stage. + */ + WithCreate withInstanceView(VirtualMachineExtensionInstanceView instanceView); + } + /** The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + WithCreate withSuppressFailures(Boolean suppressFailures); + } + /** + * The stage of the VirtualMachineScaleSetVMExtension definition allowing to specify + * protectedSettingsFromKeyVault. + */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + WithCreate withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Begins update for the VirtualMachineScaleSetVMExtension resource. + * + * @return the stage of resource update. + */ + VirtualMachineScaleSetVMExtension.Update update(); + + /** The template for VirtualMachineScaleSetVMExtension update. */ + interface Update + extends UpdateStages.WithForceUpdateTag, + UpdateStages.WithPublisher, + UpdateStages.WithTypePropertiesType, + UpdateStages.WithTypeHandlerVersion, + UpdateStages.WithAutoUpgradeMinorVersion, + UpdateStages.WithEnableAutomaticUpgrade, + UpdateStages.WithSettings, + UpdateStages.WithProtectedSettings, + UpdateStages.WithSuppressFailures, + UpdateStages.WithProtectedSettingsFromKeyVault { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineScaleSetVMExtension apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineScaleSetVMExtension apply(Context context); + } + /** The VirtualMachineScaleSetVMExtension update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + Update withPublisher(String publisher); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + Update withTypePropertiesType(String typePropertiesType); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + Update withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify enableAutomaticUpgrade. */ + interface WithEnableAutomaticUpgrade { + /** + * Specifies the enableAutomaticUpgrade property: Indicates whether the extension should be automatically + * upgraded by the platform if there is a newer version of the extension available.. + * + * @param enableAutomaticUpgrade Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * @return the next definition stage. + */ + Update withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + Update withSettings(Object settings); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + Update withProtectedSettings(Object protectedSettings); + } + /** The stage of the VirtualMachineScaleSetVMExtension update allowing to specify suppressFailures. */ + interface WithSuppressFailures { + /** + * Specifies the suppressFailures property: Indicates whether failures stemming from the extension will be + * suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of + * this value). The default is false.. + * + * @param suppressFailures Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this + * value). The default is false. + * @return the next definition stage. + */ + Update withSuppressFailures(Boolean suppressFailures); + } + /** + * The stage of the VirtualMachineScaleSetVMExtension update allowing to specify protectedSettingsFromKeyVault. + */ + interface WithProtectedSettingsFromKeyVault { + /** + * Specifies the protectedSettingsFromKeyVault property: The extensions protected settings that are passed + * by reference, and consumed from key vault. + * + * @param protectedSettingsFromKeyVault The extensions protected settings that are passed by reference, and + * consumed from key vault. + * @return the next definition stage. + */ + Update withProtectedSettingsFromKeyVault(Object protectedSettingsFromKeyVault); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachineScaleSetVMExtension refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineScaleSetVMExtension refresh(Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionUpdate.java new file mode 100644 index 0000000000000..02195c1a35390 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionUpdate.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineExtensionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a VMSS VM Extension. */ +@Fluent +public final class VirtualMachineScaleSetVMExtensionUpdate extends SubResourceReadOnly { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionUpdate.class); + + /* + * The name of the extension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Describes the properties of a Virtual Machine Extension. + */ + @JsonProperty(value = "properties") + private VirtualMachineExtensionUpdateProperties innerProperties; + + /** + * Get the name property: The name of the extension. + * + * @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: Describes the properties of a Virtual Machine Extension. + * + * @return the innerProperties value. + */ + private VirtualMachineExtensionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.innerProperties() == null ? null : this.innerProperties().enableAutomaticUpgrade(); + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withEnableAutomaticUpgrade(enableAutomaticUpgrade); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.innerProperties() == null ? null : this.innerProperties().suppressFailures(); + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The + * default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withSuppressFailures(Boolean suppressFailures) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withSuppressFailures(suppressFailures); + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public Object protectedSettingsFromKeyVault() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettingsFromKeyVault(); + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetVMExtensionUpdate object itself. + */ + public VirtualMachineScaleSetVMExtensionUpdate withProtectedSettingsFromKeyVault( + Object protectedSettingsFromKeyVault) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineExtensionUpdateProperties(); + } + this.innerProperties().withProtectedSettingsFromKeyVault(protectedSettingsFromKeyVault); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensions.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensions.java new file mode 100644 index 0000000000000..f47ad615a4690 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensions.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachineScaleSetVMExtensions. */ +public interface VirtualMachineScaleSetVMExtensions { + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName); + + /** + * The operation to delete the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String vmExtensionName, Context context); + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension. + */ + VirtualMachineScaleSetVMExtension get( + String resourceGroupName, String vmScaleSetName, String instanceId, String vmExtensionName); + + /** + * The operation to get the VMSS VM extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmExtensionName The name of the virtual machine extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String vmExtensionName, + String expand, + Context context); + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response. + */ + VirtualMachineScaleSetVMExtensionsListResult list( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to get all extensions of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List VMSS VM Extension operation response along with {@link Response}. + */ + Response listWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context); + + /** + * The operation to get the VMSS VM extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response}. + */ + VirtualMachineScaleSetVMExtension getById(String id); + + /** + * The operation to get the VMSS VM extension. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a VMSS VM Extension along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * The operation to delete the VMSS VM extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 the VMSS VM extension. + * + * @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.resourcemanager.compute.generated.models.ApiErrorException 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 VirtualMachineScaleSetVMExtension resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineScaleSetVMExtension definition. + */ + VirtualMachineScaleSetVMExtension.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsListResult.java new file mode 100644 index 0000000000000..19413e89f7abc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsListResult.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineScaleSetVMExtensionsListResult. */ +public interface VirtualMachineScaleSetVMExtensionsListResult { + /** + * Gets the value property: The list of VMSS VM extensions. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner + * com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMExtensionsListResultInner + * object. + * + * @return the inner object. + */ + VirtualMachineScaleSetVMExtensionsListResultInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsSummary.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsSummary.java new file mode 100644 index 0000000000000..0259208782e94 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMExtensionsSummary.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Extensions summary for virtual machines of a virtual machine scale set. */ +@Immutable +public final class VirtualMachineScaleSetVMExtensionsSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMExtensionsSummary.class); + + /* + * The extension name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The extensions information. + */ + @JsonProperty(value = "statusesSummary", access = JsonProperty.Access.WRITE_ONLY) + private List statusesSummary; + + /** + * Get the name property: The extension name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the statusesSummary property: The extensions information. + * + * @return the statusesSummary value. + */ + public List statusesSummary() { + return this.statusesSummary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusesSummary() != null) { + statusesSummary().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceIDs.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceIDs.java new file mode 100644 index 0000000000000..d6057c562c172 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceIDs.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies a list of virtual machine instance IDs from the VM scale set. */ +@Fluent +public final class VirtualMachineScaleSetVMInstanceIDs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMInstanceIDs.class); + + /* + * The virtual machine scale set instance ids. Omitting the virtual machine + * scale set instance ids will result in the operation being performed on + * all virtual machines in the virtual machine scale set. + */ + @JsonProperty(value = "instanceIds") + private List instanceIds; + + /** + * Get the instanceIds property: The virtual machine scale set instance ids. Omitting the virtual machine scale set + * instance ids will result in the operation being performed on all virtual machines in the virtual machine scale + * set. + * + * @return the instanceIds value. + */ + public List instanceIds() { + return this.instanceIds; + } + + /** + * Set the instanceIds property: The virtual machine scale set instance ids. Omitting the virtual machine scale set + * instance ids will result in the operation being performed on all virtual machines in the virtual machine scale + * set. + * + * @param instanceIds the instanceIds value to set. + * @return the VirtualMachineScaleSetVMInstanceIDs object itself. + */ + public VirtualMachineScaleSetVMInstanceIDs withInstanceIds(List instanceIds) { + this.instanceIds = instanceIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceRequiredIDs.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceRequiredIDs.java new file mode 100644 index 0000000000000..aed22dee765ba --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceRequiredIDs.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies a list of virtual machine instance IDs from the VM scale set. */ +@Fluent +public final class VirtualMachineScaleSetVMInstanceRequiredIDs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMInstanceRequiredIDs.class); + + /* + * The virtual machine scale set instance ids. + */ + @JsonProperty(value = "instanceIds", required = true) + private List instanceIds; + + /** + * Get the instanceIds property: The virtual machine scale set instance ids. + * + * @return the instanceIds value. + */ + public List instanceIds() { + return this.instanceIds; + } + + /** + * Set the instanceIds property: The virtual machine scale set instance ids. + * + * @param instanceIds the instanceIds value to set. + * @return the VirtualMachineScaleSetVMInstanceRequiredIDs object itself. + */ + public VirtualMachineScaleSetVMInstanceRequiredIDs withInstanceIds(List instanceIds) { + this.instanceIds = instanceIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceIds() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property instanceIds in model VirtualMachineScaleSetVMInstanceRequiredIDs")); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceView.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceView.java new file mode 100644 index 0000000000000..44f4123fb36e3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMInstanceView.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner; +import java.util.List; + +/** An immutable client-side representation of VirtualMachineScaleSetVMInstanceView. */ +public interface VirtualMachineScaleSetVMInstanceView { + /** + * Gets the platformUpdateDomain property: The Update Domain count. + * + * @return the platformUpdateDomain value. + */ + Integer platformUpdateDomain(); + + /** + * Gets the platformFaultDomain property: The Fault Domain count. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the rdpThumbPrint property: The Remote desktop certificate thumbprint. + * + * @return the rdpThumbPrint value. + */ + String rdpThumbPrint(); + + /** + * Gets the vmAgent property: The VM Agent running on the virtual machine. + * + * @return the vmAgent value. + */ + VirtualMachineAgentInstanceView vmAgent(); + + /** + * Gets the maintenanceRedeployStatus property: The Maintenance Operation status on the virtual machine. + * + * @return the maintenanceRedeployStatus value. + */ + MaintenanceRedeployStatus maintenanceRedeployStatus(); + + /** + * Gets the disks property: The disks information. + * + * @return the disks value. + */ + List disks(); + + /** + * Gets the extensions property: The extensions information. + * + * @return the extensions value. + */ + List extensions(); + + /** + * Gets the vmHealth property: The health status for the VM. + * + * @return the vmHealth value. + */ + VirtualMachineHealthStatus vmHealth(); + + /** + * Gets the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console + * Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console + * log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @return the bootDiagnostics value. + */ + BootDiagnosticsInstanceView bootDiagnostics(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the assignedHost property: Resource id of the dedicated host, on which the virtual machine is allocated + * through automatic placement, when the virtual machine is associated with a dedicated host group that has + * automatic placement enabled. <br><br>Minimum api-version: 2020-06-01. + * + * @return the assignedHost value. + */ + String assignedHost(); + + /** + * Gets the placementGroupId property: The placement group in which the VM is running. If the VM is deallocated it + * will not have a placementGroupId. + * + * @return the placementGroupId value. + */ + String placementGroupId(); + + /** + * Gets the inner + * com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInstanceViewInner object. + * + * @return the inner object. + */ + VirtualMachineScaleSetVMInstanceViewInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMListResult.java new file mode 100644 index 0000000000000..fdcc58311dd37 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine Scale Set VMs operation response. */ +@Fluent +public final class VirtualMachineScaleSetVMListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMListResult.class); + + /* + * The list of virtual machine scale sets VMs. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + * ListNext() with this to fetch the next page of VMSS VMs + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of virtual machine scale sets VMs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machine scale sets VMs. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetVMListResult object itself. + */ + public VirtualMachineScaleSetVMListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with + * this to fetch the next page of VMSS VMs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with + * this to fetch the next page of VMSS VMs. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetVMListResult object itself. + */ + public VirtualMachineScaleSetVMListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetVMListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMNetworkProfileConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMNetworkProfileConfiguration.java new file mode 100644 index 0000000000000..6da8dd9f9f8fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMNetworkProfileConfiguration.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a virtual machine scale set VM network profile. */ +@Fluent +public final class VirtualMachineScaleSetVMNetworkProfileConfiguration { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMNetworkProfileConfiguration.class); + + /* + * The list of network configurations. + */ + @JsonProperty(value = "networkInterfaceConfigurations") + private List networkInterfaceConfigurations; + + /** + * Get the networkInterfaceConfigurations property: The list of network configurations. + * + * @return the networkInterfaceConfigurations value. + */ + public List networkInterfaceConfigurations() { + return this.networkInterfaceConfigurations; + } + + /** + * Set the networkInterfaceConfigurations property: The list of network configurations. + * + * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set. + * @return the VirtualMachineScaleSetVMNetworkProfileConfiguration object itself. + */ + public VirtualMachineScaleSetVMNetworkProfileConfiguration withNetworkInterfaceConfigurations( + List networkInterfaceConfigurations) { + this.networkInterfaceConfigurations = networkInterfaceConfigurations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaceConfigurations() != null) { + networkInterfaceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProfile.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProfile.java new file mode 100644 index 0000000000000..14c7a72b40672 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProfile.java @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a virtual machine scale set virtual machine profile. */ +@Fluent +public final class VirtualMachineScaleSetVMProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMProfile.class); + + /* + * Specifies the operating system settings for the virtual machines in the + * scale set. + */ + @JsonProperty(value = "osProfile") + private VirtualMachineScaleSetOSProfile osProfile; + + /* + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "storageProfile") + private VirtualMachineScaleSetStorageProfile storageProfile; + + /* + * Specifies properties of the network interfaces of the virtual machines + * in the scale set. + */ + @JsonProperty(value = "networkProfile") + private VirtualMachineScaleSetNetworkProfile networkProfile; + + /* + * Specifies the Security related profile settings for the virtual machines + * in the scale set. + */ + @JsonProperty(value = "securityProfile") + private SecurityProfile securityProfile; + + /* + * Specifies the boot diagnostic settings state.

    Minimum + * api-version: 2015-06-15. + */ + @JsonProperty(value = "diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /* + * Specifies a collection of settings for extensions installed on virtual + * machines in the scale set. + */ + @JsonProperty(value = "extensionProfile") + private VirtualMachineScaleSetExtensionProfile extensionProfile; + + /* + * Specifies that the image or disk that is being used was licensed + * on-premises.

    Possible values for Windows Server operating + * system are:

    Windows_Client

    Windows_Server

    + * Possible values for Linux Server operating system are:

    + * RHEL_BYOS (for RHEL)

    SLES_BYOS (for SUSE)

    For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + *

    [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + *

    Minimum api-version: 2015-06-15 + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * Specifies the priority for the virtual machines in the scale set. + *

    Minimum api-version: 2017-10-30-preview + */ + @JsonProperty(value = "priority") + private VirtualMachinePriorityTypes priority; + + /* + * Specifies the eviction policy for the Azure Spot virtual machine and + * Azure Spot scale set.

    For Azure Spot virtual machines, both + * 'Deallocate' and 'Delete' are supported and the minimum api-version is + * 2019-03-01.

    For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is + * 2017-10-30-preview. + */ + @JsonProperty(value = "evictionPolicy") + private VirtualMachineEvictionPolicyTypes evictionPolicy; + + /* + * Specifies the billing related details of a Azure Spot VMSS. + *

    Minimum api-version: 2019-03-01. + */ + @JsonProperty(value = "billingProfile") + private BillingProfile billingProfile; + + /* + * Specifies Scheduled Event related configurations. + */ + @JsonProperty(value = "scheduledEventsProfile") + private ScheduledEventsProfile scheduledEventsProfile; + + /* + * UserData for the virtual machines in the scale set, which must be + * base-64 encoded. Customer should not pass any secrets in here. + *

    Minimum api-version: 2021-03-01 + */ + @JsonProperty(value = "userData") + private String userData; + + /* + * Specifies the capacity reservation related details of a scale set. + *

    Minimum api-version: 2021-04-01. + */ + @JsonProperty(value = "capacityReservation") + private CapacityReservationProfile capacityReservation; + + /* + * Specifies the gallery applications that should be made available to the + * VM/VMSS + */ + @JsonProperty(value = "applicationProfile") + private ApplicationProfile applicationProfile; + + /* + * Specifies the hardware profile related details of a scale set. + *

    Minimum api-version: 2021-11-01. + */ + @JsonProperty(value = "hardwareProfile") + private VirtualMachineScaleSetHardwareProfile hardwareProfile; + + /** + * Get the osProfile property: Specifies the operating system settings for the virtual machines in the scale set. + * + * @return the osProfile value. + */ + public VirtualMachineScaleSetOSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings for the virtual machines in the scale set. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withOsProfile(VirtualMachineScaleSetOSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public VirtualMachineScaleSetStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withStorageProfile(VirtualMachineScaleSetStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the networkProfile property: Specifies properties of the network interfaces of the virtual machines in the + * scale set. + * + * @return the networkProfile value. + */ + public VirtualMachineScaleSetNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Specifies properties of the network interfaces of the virtual machines in the + * scale set. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withNetworkProfile(VirtualMachineScaleSetNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machines in the + * scale set. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machines in the + * scale set. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the extensionProfile property: Specifies a collection of settings for extensions installed on virtual + * machines in the scale set. + * + * @return the extensionProfile value. + */ + public VirtualMachineScaleSetExtensionProfile extensionProfile() { + return this.extensionProfile; + } + + /** + * Set the extensionProfile property: Specifies a collection of settings for extensions installed on virtual + * machines in the scale set. + * + * @param extensionProfile the extensionProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withExtensionProfile( + VirtualMachineScaleSetExtensionProfile extensionProfile) { + this.extensionProfile = extensionProfile; + return this; + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the priority property: Specifies the priority for the virtual machines in the scale set. + * <br><br>Minimum api-version: 2017-10-30-preview. + * + * @return the priority value. + */ + public VirtualMachinePriorityTypes priority() { + return this.priority; + } + + /** + * Set the priority property: Specifies the priority for the virtual machines in the scale set. + * <br><br>Minimum api-version: 2017-10-30-preview. + * + * @param priority the priority value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withPriority(VirtualMachinePriorityTypes priority) { + this.priority = priority; + return this; + } + + /** + * Get the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + public VirtualMachineEvictionPolicyTypes evictionPolicy() { + return this.evictionPolicy; + } + + /** + * Set the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @param evictionPolicy the evictionPolicy value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withEvictionPolicy(VirtualMachineEvictionPolicyTypes evictionPolicy) { + this.evictionPolicy = evictionPolicy; + return this; + } + + /** + * Get the billingProfile property: Specifies the billing related details of a Azure Spot VMSS. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + public BillingProfile billingProfile() { + return this.billingProfile; + } + + /** + * Set the billingProfile property: Specifies the billing related details of a Azure Spot VMSS. + * <br><br>Minimum api-version: 2019-03-01. + * + * @param billingProfile the billingProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withBillingProfile(BillingProfile billingProfile) { + this.billingProfile = billingProfile; + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.scheduledEventsProfile; + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + this.scheduledEventsProfile = scheduledEventsProfile; + return this; + } + + /** + * Get the userData property: UserData for the virtual machines in the scale set, which must be base-64 encoded. + * Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.userData; + } + + /** + * Set the userData property: UserData for the virtual machines in the scale set, which must be base-64 encoded. + * Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @param userData the userData value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withUserData(String userData) { + this.userData = userData; + return this; + } + + /** + * Get the capacityReservation property: Specifies the capacity reservation related details of a scale set. + * <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + public CapacityReservationProfile capacityReservation() { + return this.capacityReservation; + } + + /** + * Set the capacityReservation property: Specifies the capacity reservation related details of a scale set. + * <br><br>Minimum api-version: 2021-04-01. + * + * @param capacityReservation the capacityReservation value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withCapacityReservation(CapacityReservationProfile capacityReservation) { + this.capacityReservation = capacityReservation; + return this; + } + + /** + * Get the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + public ApplicationProfile applicationProfile() { + return this.applicationProfile; + } + + /** + * Set the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param applicationProfile the applicationProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withApplicationProfile(ApplicationProfile applicationProfile) { + this.applicationProfile = applicationProfile; + return this; + } + + /** + * Get the hardwareProfile property: Specifies the hardware profile related details of a scale set. + * <br><br>Minimum api-version: 2021-11-01. + * + * @return the hardwareProfile value. + */ + public VirtualMachineScaleSetHardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Specifies the hardware profile related details of a scale set. + * <br><br>Minimum api-version: 2021-11-01. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineScaleSetVMProfile object itself. + */ + public VirtualMachineScaleSetVMProfile withHardwareProfile(VirtualMachineScaleSetHardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osProfile() != null) { + osProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (extensionProfile() != null) { + extensionProfile().validate(); + } + if (billingProfile() != null) { + billingProfile().validate(); + } + if (scheduledEventsProfile() != null) { + scheduledEventsProfile().validate(); + } + if (capacityReservation() != null) { + capacityReservation().validate(); + } + if (applicationProfile() != null) { + applicationProfile().validate(); + } + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProperties.java new file mode 100644 index 0000000000000..e6506428c3acb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMPropertiesInner; + +/** An immutable client-side representation of VirtualMachineScaleSetVMProperties. */ +public interface VirtualMachineScaleSetVMProperties { + /** + * Gets the latestModelApplied property: Specifies whether the latest model has been applied to the virtual machine. + * + * @return the latestModelApplied value. + */ + Boolean latestModelApplied(); + + /** + * Gets the vmId property: Azure VM unique ID. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + VirtualMachineScaleSetVMInstanceView instanceView(); + + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine in the scale set. For instance: whether the virtual machine has the capability to support attaching + * managed data disks with UltraSSD_LRS storage account type. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the osProfile property: Specifies the operating system settings for the virtual machine. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + SecurityProfile securityProfile(); + + /** + * Gets the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the networkProfileConfiguration property: Specifies the network profile configuration of the virtual + * machine. + * + * @return the networkProfileConfiguration value. + */ + VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration(); + + /** + * Gets the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + DiagnosticsProfile diagnosticsProfile(); + + /** + * Gets the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + * set. + * + * @return the availabilitySet value. + */ + SubResource availabilitySet(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + String licenseType(); + + /** + * Gets the modelDefinitionApplied property: Specifies whether the model applied to the virtual machine is the model + * of the virtual machine scale set or the customized model for the virtual machine. + * + * @return the modelDefinitionApplied value. + */ + String modelDefinitionApplied(); + + /** + * Gets the protectionPolicy property: Specifies the protection policy of the virtual machine. + * + * @return the protectionPolicy value. + */ + VirtualMachineScaleSetVMProtectionPolicy protectionPolicy(); + + /** + * Gets the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + String userData(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMPropertiesInner + * object. + * + * @return the inner object. + */ + VirtualMachineScaleSetVMPropertiesInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProtectionPolicy.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProtectionPolicy.java new file mode 100644 index 0000000000000..e1cbbed82e178 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMProtectionPolicy.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The protection policy of a virtual machine scale set VM. */ +@Fluent +public final class VirtualMachineScaleSetVMProtectionPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMProtectionPolicy.class); + + /* + * Indicates that the virtual machine scale set VM shouldn't be considered + * for deletion during a scale-in operation. + */ + @JsonProperty(value = "protectFromScaleIn") + private Boolean protectFromScaleIn; + + /* + * Indicates that model updates or actions (including scale-in) initiated + * on the virtual machine scale set should not be applied to the virtual + * machine scale set VM. + */ + @JsonProperty(value = "protectFromScaleSetActions") + private Boolean protectFromScaleSetActions; + + /** + * Get the protectFromScaleIn property: Indicates that the virtual machine scale set VM shouldn't be considered for + * deletion during a scale-in operation. + * + * @return the protectFromScaleIn value. + */ + public Boolean protectFromScaleIn() { + return this.protectFromScaleIn; + } + + /** + * Set the protectFromScaleIn property: Indicates that the virtual machine scale set VM shouldn't be considered for + * deletion during a scale-in operation. + * + * @param protectFromScaleIn the protectFromScaleIn value to set. + * @return the VirtualMachineScaleSetVMProtectionPolicy object itself. + */ + public VirtualMachineScaleSetVMProtectionPolicy withProtectFromScaleIn(Boolean protectFromScaleIn) { + this.protectFromScaleIn = protectFromScaleIn; + return this; + } + + /** + * Get the protectFromScaleSetActions property: Indicates that model updates or actions (including scale-in) + * initiated on the virtual machine scale set should not be applied to the virtual machine scale set VM. + * + * @return the protectFromScaleSetActions value. + */ + public Boolean protectFromScaleSetActions() { + return this.protectFromScaleSetActions; + } + + /** + * Set the protectFromScaleSetActions property: Indicates that model updates or actions (including scale-in) + * initiated on the virtual machine scale set should not be applied to the virtual machine scale set VM. + * + * @param protectFromScaleSetActions the protectFromScaleSetActions value to set. + * @return the VirtualMachineScaleSetVMProtectionPolicy object itself. + */ + public VirtualMachineScaleSetVMProtectionPolicy withProtectFromScaleSetActions(Boolean protectFromScaleSetActions) { + this.protectFromScaleSetActions = protectFromScaleSetActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMReimageParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMReimageParameters.java new file mode 100644 index 0000000000000..8cff9b83095cb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMReimageParameters.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Describes a Virtual Machine Scale Set VM Reimage Parameters. */ +@Fluent +public class VirtualMachineScaleSetVMReimageParameters extends VirtualMachineReimageParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineScaleSetVMReimageParameters.class); + + /** {@inheritDoc} */ + @Override + public VirtualMachineScaleSetVMReimageParameters withTempDisk(Boolean tempDisk) { + super.withTempDisk(tempDisk); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMRunCommands.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMRunCommands.java new file mode 100644 index 0000000000000..9a398ca1c0a58 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMRunCommands.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineRunCommandInner; + +/** Resource collection API of VirtualMachineScaleSetVMRunCommands. */ +public interface VirtualMachineScaleSetVMRunCommands { + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand); + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand createOrUpdate( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandInner runCommand, + Context context); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand); + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + VirtualMachineRunCommandUpdate runCommand, + Context context); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, String runCommandName, Context context); + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command. + */ + VirtualMachineRunCommand get( + String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine run command along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + String runCommandName, + String expand, + Context context); + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + PagedIterable list(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List run command operation response. + */ + PagedIterable list( + String resourceGroupName, String vmScaleSetName, String instanceId, String expand, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMs.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMs.java new file mode 100644 index 0000000000000..37fdcec677d8f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSetVMs.java @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; + +/** Resource collection API of VirtualMachineScaleSetVMs. */ +public interface VirtualMachineScaleSetVMs { + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, + Context context); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is + * only supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute + * resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + VirtualMachineScaleSetVM update( + String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters); + + /** + * Updates a virtual machine of a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a virtual machine scale set virtual machine. + */ + VirtualMachineScaleSetVM update( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + VirtualMachineScaleSetVMInner parameters, + Context context); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId); + + /** + * Deletes a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, String instanceId, Boolean forceDeletion, Context context); + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 from a VM scale set. + */ + VirtualMachineScaleSetVM get(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Gets a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of + * the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 from a VM scale set along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context); + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set. + */ + VirtualMachineScaleSetVMInstanceView getInstanceView( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Gets the status of a virtual machine from a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a virtual machine from a VM scale set along with {@link Response}. + */ + Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + PagedIterable list(String resourceGroupName, String virtualMachineScaleSetName); + + /** + * Gets a list of all virtual machines in a VM scale sets. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineScaleSetName The name of the VM scale set. + * @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + * 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + * @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + * @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtual machines in a VM scale sets. + */ + PagedIterable list( + String resourceGroupName, + String virtualMachineScaleSetName, + String filter, + String select, + String expand, + Context context); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting + * charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff( + String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown, Context context); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Restarts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Starts a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData( + String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + Integer sasUriExpirationTimeInMinutes, + Context context); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * Performs maintenance on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void simulateEviction(String resourceGroupName, String vmScaleSetName, String instanceId); + + /** + * The operation to simulate the eviction of spot virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response simulateEvictionWithResponse( + String resourceGroupName, String vmScaleSetName, String instanceId, Context context); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand( + String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters); + + /** + * Run command on a virtual machine in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand( + String resourceGroupName, + String vmScaleSetName, + String instanceId, + RunCommandInput parameters, + Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSets.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSets.java new file mode 100644 index 0000000000000..cc18b25063ae0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineScaleSets.java @@ -0,0 +1,874 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 VirtualMachineScaleSets. */ +public interface VirtualMachineScaleSets { + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + PagedIterable listByLocation(String location); + + /** + * Gets all the VM scale sets under the specified subscription for the specified location. + * + * @param location The location for which VM scale sets under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the VM scale sets under the specified subscription for the specified location. + */ + PagedIterable listByLocation(String location, Context context); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, Boolean forceDeletion); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName); + + /** + * Deletes a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmScaleSetName, Boolean forceDeletion, Context context); + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set. + */ + VirtualMachineScaleSet getByResourceGroup(String resourceGroupName, String vmScaleSetName); + + /** + * Display information about a virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmScaleSetName); + + /** + * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute + * resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Deletes virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param forceDeletion Optional parameter to force delete virtual machines from the VM scale set. (Feature in + * Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Boolean forceDeletion, + Context context); + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance. + */ + VirtualMachineScaleSetInstanceView getInstanceView(String resourceGroupName, String vmScaleSetName); + + /** + * Gets the status of a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a VM scale set instance along with {@link Response}. + */ + Response getInstanceViewWithResponse( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all VM scale sets under a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM scale sets under a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + PagedIterable list(); + + /** + * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink + * property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM + * Scale Sets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all VM Scale Sets in the subscription, regardless of the associated resource group. + */ + PagedIterable list(Context context); + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + PagedIterable listSkus(String resourceGroupName, String vmScaleSetName); + + /** + * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for + * each SKU. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed + * for each SKU. + */ + PagedIterable listSkus(String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName); + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of OS upgrades on a VM scale set instance. + */ + PagedIterable getOSUpgradeHistory( + String resourceGroupName, String vmScaleSetName, Context context); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmScaleSetName); + + /** + * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you + * are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff( + String resourceGroupName, + String vmScaleSetName, + Boolean skipShutdown, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName); + + /** + * Restarts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmScaleSetName); + + /** + * Starts one or more virtual machines in a VM scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmScaleSetName); + + /** + * Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them + * back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(String resourceGroupName, String vmScaleSetName); + + /** + * Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not + * eligible for perform maintenance will be failed. Please refer to best practices for more details: + * https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateInstances( + String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs); + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void updateInstances( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, + Context context); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String vmScaleSetName); + + /** + * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a + * ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + * state. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmScaleSetReimageInput Parameters for Reimaging VM ScaleSet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput, + Context context); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll(String resourceGroupName, String vmScaleSetName); + + /** + * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only + * supported for managed disks. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimageAll( + String resourceGroupName, + String vmScaleSetName, + VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, + Context context); + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk. + */ + RecoveryWalkResponse forceRecoveryServiceFabricPlatformUpdateDomainWalk( + String resourceGroupName, String vmScaleSetName, int platformUpdateDomain); + + /** + * Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param platformUpdateDomain The platform update domain for which a manual recovery walk is requested. + * @param zone The zone in which the manual recovery walk is requested for cross zone virtual machine scale set. + * @param placementGroupId The placement group id for which the manual recovery walk is requested. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response after calling a manual recovery walk along with {@link Response}. + */ + Response forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + String resourceGroupName, + String vmScaleSetName, + int platformUpdateDomain, + String zone, + String placementGroupId, + Context context); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToSinglePlacementGroup( + String resourceGroupName, String vmScaleSetName, VMScaleSetConvertToSinglePlacementGroupInput parameters); + + /** + * Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for ConvertToSinglePlacementGroup API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response convertToSinglePlacementGroupWithResponse( + String resourceGroupName, + String vmScaleSetName, + VMScaleSetConvertToSinglePlacementGroupInput parameters, + Context context); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters); + + /** + * Changes ServiceState property for a given service. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the virtual machine scale set to create or update. + * @param parameters The input object for SetOrchestrationServiceState API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void setOrchestrationServiceState( + String resourceGroupName, String vmScaleSetName, OrchestrationServiceStateInput parameters, Context context); + + /** + * Display information about a virtual machine scale set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response}. + */ + VirtualMachineScaleSet getById(String id); + + /** + * Display information about a virtual machine scale set. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the + * VM scale set that was provided by the user during the VM scale set Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine Scale Set along with {@link Response}. + */ + Response getByIdWithResponse( + String id, ExpandTypesForGetVMScaleSets expand, Context context); + + /** + * Deletes a VM scale set. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 a VM scale set. + * + * @param id the resource ID. + * @param forceDeletion Optional parameter to force delete a VM scale set. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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, Boolean forceDeletion, Context context); + + /** + * Begins definition for a new VirtualMachineScaleSet resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineScaleSet definition. + */ + VirtualMachineScaleSet.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSize.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSize.java new file mode 100644 index 0000000000000..8ffc12b7aadfa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSize.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; + +/** An immutable client-side representation of VirtualMachineSize. */ +public interface VirtualMachineSize { + /** + * Gets the name property: The name of the virtual machine size. + * + * @return the name value. + */ + String name(); + + /** + * Gets the numberOfCores property: The number of cores supported by the virtual machine size. For Constrained vCPU + * capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, + * please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or + * https://docs.microsoft.com/rest/api/compute/resourceskus/list. + * + * @return the numberOfCores value. + */ + Integer numberOfCores(); + + /** + * Gets the osDiskSizeInMB property: The OS disk size, in MB, allowed by the virtual machine size. + * + * @return the osDiskSizeInMB value. + */ + Integer osDiskSizeInMB(); + + /** + * Gets the resourceDiskSizeInMB property: The resource disk size, in MB, allowed by the virtual machine size. + * + * @return the resourceDiskSizeInMB value. + */ + Integer resourceDiskSizeInMB(); + + /** + * Gets the memoryInMB property: The amount of memory, in MB, supported by the virtual machine size. + * + * @return the memoryInMB value. + */ + Integer memoryInMB(); + + /** + * Gets the maxDataDiskCount property: The maximum number of data disks that can be attached to the virtual machine + * size. + * + * @return the maxDataDiskCount value. + */ + Integer maxDataDiskCount(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner object. + * + * @return the inner object. + */ + VirtualMachineSizeInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeListResult.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeListResult.java new file mode 100644 index 0000000000000..496d3d07cb5e7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineSizeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Virtual Machine operation response. */ +@Fluent +public final class VirtualMachineSizeListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineSizeListResult.class); + + /* + * The list of virtual machine sizes. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of virtual machine sizes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of virtual machine sizes. + * + * @param value the value value to set. + * @return the VirtualMachineSizeListResult object itself. + */ + public VirtualMachineSizeListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeTypes.java new file mode 100644 index 0000000000000..70e24121b0664 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizeTypes.java @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualMachineSizeTypes. */ +public final class VirtualMachineSizeTypes extends ExpandableStringEnum { + /** Static value Basic_A0 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes BASIC_A0 = fromString("Basic_A0"); + + /** Static value Basic_A1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes BASIC_A1 = fromString("Basic_A1"); + + /** Static value Basic_A2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes BASIC_A2 = fromString("Basic_A2"); + + /** Static value Basic_A3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes BASIC_A3 = fromString("Basic_A3"); + + /** Static value Basic_A4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes BASIC_A4 = fromString("Basic_A4"); + + /** Static value Standard_A0 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A0 = fromString("Standard_A0"); + + /** Static value Standard_A1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A1 = fromString("Standard_A1"); + + /** Static value Standard_A2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A2 = fromString("Standard_A2"); + + /** Static value Standard_A3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A3 = fromString("Standard_A3"); + + /** Static value Standard_A4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A4 = fromString("Standard_A4"); + + /** Static value Standard_A5 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A5 = fromString("Standard_A5"); + + /** Static value Standard_A6 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A6 = fromString("Standard_A6"); + + /** Static value Standard_A7 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A7 = fromString("Standard_A7"); + + /** Static value Standard_A8 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A8 = fromString("Standard_A8"); + + /** Static value Standard_A9 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A9 = fromString("Standard_A9"); + + /** Static value Standard_A10 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A10 = fromString("Standard_A10"); + + /** Static value Standard_A11 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A11 = fromString("Standard_A11"); + + /** Static value Standard_A1_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A1_V2 = fromString("Standard_A1_v2"); + + /** Static value Standard_A2_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A2_V2 = fromString("Standard_A2_v2"); + + /** Static value Standard_A4_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A4_V2 = fromString("Standard_A4_v2"); + + /** Static value Standard_A8_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A8_V2 = fromString("Standard_A8_v2"); + + /** Static value Standard_A2m_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A2M_V2 = fromString("Standard_A2m_v2"); + + /** Static value Standard_A4m_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A4M_V2 = fromString("Standard_A4m_v2"); + + /** Static value Standard_A8m_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_A8M_V2 = fromString("Standard_A8m_v2"); + + /** Static value Standard_B1s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B1S = fromString("Standard_B1s"); + + /** Static value Standard_B1ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B1MS = fromString("Standard_B1ms"); + + /** Static value Standard_B2s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B2S = fromString("Standard_B2s"); + + /** Static value Standard_B2ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B2MS = fromString("Standard_B2ms"); + + /** Static value Standard_B4ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B4MS = fromString("Standard_B4ms"); + + /** Static value Standard_B8ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_B8MS = fromString("Standard_B8ms"); + + /** Static value Standard_D1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D1 = fromString("Standard_D1"); + + /** Static value Standard_D2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D2 = fromString("Standard_D2"); + + /** Static value Standard_D3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D3 = fromString("Standard_D3"); + + /** Static value Standard_D4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D4 = fromString("Standard_D4"); + + /** Static value Standard_D11 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D11 = fromString("Standard_D11"); + + /** Static value Standard_D12 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D12 = fromString("Standard_D12"); + + /** Static value Standard_D13 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D13 = fromString("Standard_D13"); + + /** Static value Standard_D14 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D14 = fromString("Standard_D14"); + + /** Static value Standard_D1_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D1_V2 = fromString("Standard_D1_v2"); + + /** Static value Standard_D2_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D2_V2 = fromString("Standard_D2_v2"); + + /** Static value Standard_D3_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D3_V2 = fromString("Standard_D3_v2"); + + /** Static value Standard_D4_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D4_V2 = fromString("Standard_D4_v2"); + + /** Static value Standard_D5_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D5_V2 = fromString("Standard_D5_v2"); + + /** Static value Standard_D2_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D2_V3 = fromString("Standard_D2_v3"); + + /** Static value Standard_D4_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D4_V3 = fromString("Standard_D4_v3"); + + /** Static value Standard_D8_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D8_V3 = fromString("Standard_D8_v3"); + + /** Static value Standard_D16_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D16_V3 = fromString("Standard_D16_v3"); + + /** Static value Standard_D32_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D32_V3 = fromString("Standard_D32_v3"); + + /** Static value Standard_D64_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D64_V3 = fromString("Standard_D64_v3"); + + /** Static value Standard_D2s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D2S_V3 = fromString("Standard_D2s_v3"); + + /** Static value Standard_D4s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D4S_V3 = fromString("Standard_D4s_v3"); + + /** Static value Standard_D8s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D8S_V3 = fromString("Standard_D8s_v3"); + + /** Static value Standard_D16s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D16S_V3 = fromString("Standard_D16s_v3"); + + /** Static value Standard_D32s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D32S_V3 = fromString("Standard_D32s_v3"); + + /** Static value Standard_D64s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D64S_V3 = fromString("Standard_D64s_v3"); + + /** Static value Standard_D11_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D11_V2 = fromString("Standard_D11_v2"); + + /** Static value Standard_D12_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D12_V2 = fromString("Standard_D12_v2"); + + /** Static value Standard_D13_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D13_V2 = fromString("Standard_D13_v2"); + + /** Static value Standard_D14_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D14_V2 = fromString("Standard_D14_v2"); + + /** Static value Standard_D15_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_D15_V2 = fromString("Standard_D15_v2"); + + /** Static value Standard_DS1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS1 = fromString("Standard_DS1"); + + /** Static value Standard_DS2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS2 = fromString("Standard_DS2"); + + /** Static value Standard_DS3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS3 = fromString("Standard_DS3"); + + /** Static value Standard_DS4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS4 = fromString("Standard_DS4"); + + /** Static value Standard_DS11 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS11 = fromString("Standard_DS11"); + + /** Static value Standard_DS12 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS12 = fromString("Standard_DS12"); + + /** Static value Standard_DS13 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS13 = fromString("Standard_DS13"); + + /** Static value Standard_DS14 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS14 = fromString("Standard_DS14"); + + /** Static value Standard_DS1_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS1_V2 = fromString("Standard_DS1_v2"); + + /** Static value Standard_DS2_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS2_V2 = fromString("Standard_DS2_v2"); + + /** Static value Standard_DS3_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS3_V2 = fromString("Standard_DS3_v2"); + + /** Static value Standard_DS4_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS4_V2 = fromString("Standard_DS4_v2"); + + /** Static value Standard_DS5_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS5_V2 = fromString("Standard_DS5_v2"); + + /** Static value Standard_DS11_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS11_V2 = fromString("Standard_DS11_v2"); + + /** Static value Standard_DS12_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS12_V2 = fromString("Standard_DS12_v2"); + + /** Static value Standard_DS13_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS13_V2 = fromString("Standard_DS13_v2"); + + /** Static value Standard_DS14_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS14_V2 = fromString("Standard_DS14_v2"); + + /** Static value Standard_DS15_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS15_V2 = fromString("Standard_DS15_v2"); + + /** Static value Standard_DS13-4_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS13_4_V2 = fromString("Standard_DS13-4_v2"); + + /** Static value Standard_DS13-2_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS13_2_V2 = fromString("Standard_DS13-2_v2"); + + /** Static value Standard_DS14-8_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS14_8_V2 = fromString("Standard_DS14-8_v2"); + + /** Static value Standard_DS14-4_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_DS14_4_V2 = fromString("Standard_DS14-4_v2"); + + /** Static value Standard_E2_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E2_V3 = fromString("Standard_E2_v3"); + + /** Static value Standard_E4_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E4_V3 = fromString("Standard_E4_v3"); + + /** Static value Standard_E8_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E8_V3 = fromString("Standard_E8_v3"); + + /** Static value Standard_E16_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E16_V3 = fromString("Standard_E16_v3"); + + /** Static value Standard_E32_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E32_V3 = fromString("Standard_E32_v3"); + + /** Static value Standard_E64_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E64_V3 = fromString("Standard_E64_v3"); + + /** Static value Standard_E2s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E2S_V3 = fromString("Standard_E2s_v3"); + + /** Static value Standard_E4s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E4S_V3 = fromString("Standard_E4s_v3"); + + /** Static value Standard_E8s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E8S_V3 = fromString("Standard_E8s_v3"); + + /** Static value Standard_E16s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E16S_V3 = fromString("Standard_E16s_v3"); + + /** Static value Standard_E32s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E32S_V3 = fromString("Standard_E32s_v3"); + + /** Static value Standard_E64s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E64S_V3 = fromString("Standard_E64s_v3"); + + /** Static value Standard_E32-16_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E32_16_V3 = fromString("Standard_E32-16_v3"); + + /** Static value Standard_E32-8s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E32_8S_V3 = fromString("Standard_E32-8s_v3"); + + /** Static value Standard_E64-32s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E64_32S_V3 = fromString("Standard_E64-32s_v3"); + + /** Static value Standard_E64-16s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_E64_16S_V3 = fromString("Standard_E64-16s_v3"); + + /** Static value Standard_F1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F1 = fromString("Standard_F1"); + + /** Static value Standard_F2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F2 = fromString("Standard_F2"); + + /** Static value Standard_F4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F4 = fromString("Standard_F4"); + + /** Static value Standard_F8 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F8 = fromString("Standard_F8"); + + /** Static value Standard_F16 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F16 = fromString("Standard_F16"); + + /** Static value Standard_F1s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F1S = fromString("Standard_F1s"); + + /** Static value Standard_F2s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F2S = fromString("Standard_F2s"); + + /** Static value Standard_F4s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F4S = fromString("Standard_F4s"); + + /** Static value Standard_F8s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F8S = fromString("Standard_F8s"); + + /** Static value Standard_F16s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F16S = fromString("Standard_F16s"); + + /** Static value Standard_F2s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F2S_V2 = fromString("Standard_F2s_v2"); + + /** Static value Standard_F4s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F4S_V2 = fromString("Standard_F4s_v2"); + + /** Static value Standard_F8s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F8S_V2 = fromString("Standard_F8s_v2"); + + /** Static value Standard_F16s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F16S_V2 = fromString("Standard_F16s_v2"); + + /** Static value Standard_F32s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F32S_V2 = fromString("Standard_F32s_v2"); + + /** Static value Standard_F64s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F64S_V2 = fromString("Standard_F64s_v2"); + + /** Static value Standard_F72s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_F72S_V2 = fromString("Standard_F72s_v2"); + + /** Static value Standard_G1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_G1 = fromString("Standard_G1"); + + /** Static value Standard_G2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_G2 = fromString("Standard_G2"); + + /** Static value Standard_G3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_G3 = fromString("Standard_G3"); + + /** Static value Standard_G4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_G4 = fromString("Standard_G4"); + + /** Static value Standard_G5 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_G5 = fromString("Standard_G5"); + + /** Static value Standard_GS1 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS1 = fromString("Standard_GS1"); + + /** Static value Standard_GS2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS2 = fromString("Standard_GS2"); + + /** Static value Standard_GS3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS3 = fromString("Standard_GS3"); + + /** Static value Standard_GS4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS4 = fromString("Standard_GS4"); + + /** Static value Standard_GS5 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS5 = fromString("Standard_GS5"); + + /** Static value Standard_GS4-8 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS4_8 = fromString("Standard_GS4-8"); + + /** Static value Standard_GS4-4 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS4_4 = fromString("Standard_GS4-4"); + + /** Static value Standard_GS5-16 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS5_16 = fromString("Standard_GS5-16"); + + /** Static value Standard_GS5-8 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_GS5_8 = fromString("Standard_GS5-8"); + + /** Static value Standard_H8 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H8 = fromString("Standard_H8"); + + /** Static value Standard_H16 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H16 = fromString("Standard_H16"); + + /** Static value Standard_H8m for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H8M = fromString("Standard_H8m"); + + /** Static value Standard_H16m for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H16M = fromString("Standard_H16m"); + + /** Static value Standard_H16r for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H16R = fromString("Standard_H16r"); + + /** Static value Standard_H16mr for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_H16MR = fromString("Standard_H16mr"); + + /** Static value Standard_L4s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_L4S = fromString("Standard_L4s"); + + /** Static value Standard_L8s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_L8S = fromString("Standard_L8s"); + + /** Static value Standard_L16s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_L16S = fromString("Standard_L16s"); + + /** Static value Standard_L32s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_L32S = fromString("Standard_L32s"); + + /** Static value Standard_M64s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M64S = fromString("Standard_M64s"); + + /** Static value Standard_M64ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M64MS = fromString("Standard_M64ms"); + + /** Static value Standard_M128s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M128S = fromString("Standard_M128s"); + + /** Static value Standard_M128ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M128MS = fromString("Standard_M128ms"); + + /** Static value Standard_M64-32ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M64_32MS = fromString("Standard_M64-32ms"); + + /** Static value Standard_M64-16ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M64_16MS = fromString("Standard_M64-16ms"); + + /** Static value Standard_M128-64ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M128_64MS = fromString("Standard_M128-64ms"); + + /** Static value Standard_M128-32ms for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_M128_32MS = fromString("Standard_M128-32ms"); + + /** Static value Standard_NC6 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC6 = fromString("Standard_NC6"); + + /** Static value Standard_NC12 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC12 = fromString("Standard_NC12"); + + /** Static value Standard_NC24 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24 = fromString("Standard_NC24"); + + /** Static value Standard_NC24r for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24R = fromString("Standard_NC24r"); + + /** Static value Standard_NC6s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC6S_V2 = fromString("Standard_NC6s_v2"); + + /** Static value Standard_NC12s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC12S_V2 = fromString("Standard_NC12s_v2"); + + /** Static value Standard_NC24s_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24S_V2 = fromString("Standard_NC24s_v2"); + + /** Static value Standard_NC24rs_v2 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24RS_V2 = fromString("Standard_NC24rs_v2"); + + /** Static value Standard_NC6s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC6S_V3 = fromString("Standard_NC6s_v3"); + + /** Static value Standard_NC12s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC12S_V3 = fromString("Standard_NC12s_v3"); + + /** Static value Standard_NC24s_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24S_V3 = fromString("Standard_NC24s_v3"); + + /** Static value Standard_NC24rs_v3 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NC24RS_V3 = fromString("Standard_NC24rs_v3"); + + /** Static value Standard_ND6s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_ND6S = fromString("Standard_ND6s"); + + /** Static value Standard_ND12s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_ND12S = fromString("Standard_ND12s"); + + /** Static value Standard_ND24s for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_ND24S = fromString("Standard_ND24s"); + + /** Static value Standard_ND24rs for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_ND24RS = fromString("Standard_ND24rs"); + + /** Static value Standard_NV6 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NV6 = fromString("Standard_NV6"); + + /** Static value Standard_NV12 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NV12 = fromString("Standard_NV12"); + + /** Static value Standard_NV24 for VirtualMachineSizeTypes. */ + public static final VirtualMachineSizeTypes STANDARD_NV24 = fromString("Standard_NV24"); + + /** + * Creates or finds a VirtualMachineSizeTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualMachineSizeTypes. + */ + @JsonCreator + public static VirtualMachineSizeTypes fromString(String name) { + return fromString(name, VirtualMachineSizeTypes.class); + } + + /** @return known VirtualMachineSizeTypes values. */ + public static Collection values() { + return values(VirtualMachineSizeTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizes.java new file mode 100644 index 0000000000000..65278857acdd9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSizes.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachineSizes. */ +public interface VirtualMachineSizes { + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(String location); + + /** + * This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list). + * + * @param location The location upon which virtual-machine-sizes is queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(String location, Context context); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSoftwarePatchProperties.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSoftwarePatchProperties.java new file mode 100644 index 0000000000000..46e4233a9a806 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineSoftwarePatchProperties.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Describes the properties of a Virtual Machine software patch. */ +@Immutable +public final class VirtualMachineSoftwarePatchProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineSoftwarePatchProperties.class); + + /* + * A unique identifier for the patch. + */ + @JsonProperty(value = "patchId", access = JsonProperty.Access.WRITE_ONLY) + private String patchId; + + /* + * The friendly name of the patch. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The version number of the patch. This property applies only to Linux + * patches. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The KBID of the patch. Only applies to Windows patches. + */ + @JsonProperty(value = "kbId", access = JsonProperty.Access.WRITE_ONLY) + private String kbId; + + /* + * The classification(s) of the patch as provided by the patch publisher. + */ + @JsonProperty(value = "classifications", access = JsonProperty.Access.WRITE_ONLY) + private List classifications; + + /* + * Describes the reboot requirements of the patch. + */ + @JsonProperty(value = "rebootBehavior", access = JsonProperty.Access.WRITE_ONLY) + private VMGuestPatchRebootBehavior rebootBehavior; + + /* + * The activity ID of the operation that produced this result. It is used + * to correlate across CRP and extension logs. + */ + @JsonProperty(value = "activityId", access = JsonProperty.Access.WRITE_ONLY) + private String activityId; + + /* + * The UTC timestamp when the repository published this patch. + */ + @JsonProperty(value = "publishedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime publishedDate; + + /* + * The UTC timestamp of the last update to this patch record. + */ + @JsonProperty(value = "lastModifiedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedDateTime; + + /* + * Describes the availability of a given patch. + */ + @JsonProperty(value = "assessmentState", access = JsonProperty.Access.WRITE_ONLY) + private PatchAssessmentState assessmentState; + + /** + * Get the patchId property: A unique identifier for the patch. + * + * @return the patchId value. + */ + public String patchId() { + return this.patchId; + } + + /** + * Get the name property: The friendly name of the patch. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the version property: The version number of the patch. This property applies only to Linux patches. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the kbId property: The KBID of the patch. Only applies to Windows patches. + * + * @return the kbId value. + */ + public String kbId() { + return this.kbId; + } + + /** + * Get the classifications property: The classification(s) of the patch as provided by the patch publisher. + * + * @return the classifications value. + */ + public List classifications() { + return this.classifications; + } + + /** + * Get the rebootBehavior property: Describes the reboot requirements of the patch. + * + * @return the rebootBehavior value. + */ + public VMGuestPatchRebootBehavior rebootBehavior() { + return this.rebootBehavior; + } + + /** + * Get the activityId property: The activity ID of the operation that produced this result. It is used to correlate + * across CRP and extension logs. + * + * @return the activityId value. + */ + public String activityId() { + return this.activityId; + } + + /** + * Get the publishedDate property: The UTC timestamp when the repository published this patch. + * + * @return the publishedDate value. + */ + public OffsetDateTime publishedDate() { + return this.publishedDate; + } + + /** + * Get the lastModifiedDateTime property: The UTC timestamp of the last update to this patch record. + * + * @return the lastModifiedDateTime value. + */ + public OffsetDateTime lastModifiedDateTime() { + return this.lastModifiedDateTime; + } + + /** + * Get the assessmentState property: Describes the availability of a given patch. + * + * @return the assessmentState value. + */ + public PatchAssessmentState assessmentState() { + return this.assessmentState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineStatusCodeCount.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineStatusCodeCount.java new file mode 100644 index 0000000000000..2ac589c0f18da --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineStatusCodeCount.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status code and count of the virtual machine scale set instance view status summary. */ +@Immutable +public final class VirtualMachineStatusCodeCount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineStatusCodeCount.class); + + /* + * The instance view status code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The number of instances having a particular status code. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /** + * Get the code property: The instance view status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the count property: The number of instances having a particular status code. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineUpdate.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineUpdate.java new file mode 100644 index 0000000000000..d67195015355e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachineUpdate.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineUpdate. */ +public interface VirtualMachineUpdate { + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the plan property: Specifies information about the marketplace image used to create the virtual machine. + * This element is only used for marketplace images. Before you can use a marketplace image from an API, you must + * enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and + * then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click + * **Save**. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the identity property: The identity of the virtual machine, if configured. + * + * @return the identity value. + */ + VirtualMachineIdentity identity(); + + /** + * Gets the zones property: The virtual machine zones. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the virtual machine. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the additionalCapabilities property: Specifies additional capabilities enabled or disabled on the virtual + * machine. + * + * @return the additionalCapabilities value. + */ + AdditionalCapabilities additionalCapabilities(); + + /** + * Gets the osProfile property: Specifies the operating system settings used while creating the virtual machine. + * Some of the settings cannot be changed once VM is provisioned. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the networkProfile property: Specifies the network interfaces of the virtual machine. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the securityProfile property: Specifies the Security related profile settings for the virtual machine. + * + * @return the securityProfile value. + */ + SecurityProfile securityProfile(); + + /** + * Gets the diagnosticsProfile property: Specifies the boot diagnostic settings state. <br><br>Minimum + * api-version: 2015-06-15. + * + * @return the diagnosticsProfile value. + */ + DiagnosticsProfile diagnosticsProfile(); + + /** + * Gets the availabilitySet property: Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes + * to maximize availability. For more information about availability sets, see [Availability sets + * overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For + * more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, + * a VM can only be added to availability set at creation time. The availability set to which the VM is being added + * should be under the same resource group as the availability set resource. An existing VM cannot be added to an + * availability set. <br><br>This property cannot exist along with a non-null + * properties.virtualMachineScaleSet reference. + * + * @return the availabilitySet value. + */ + SubResource availabilitySet(); + + /** + * Gets the virtualMachineScaleSet property: Specifies information about the virtual machine scale set that the + * virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are + * allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale + * set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This + * property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum + * api‐version: 2019‐03‐01. + * + * @return the virtualMachineScaleSet value. + */ + SubResource virtualMachineScaleSet(); + + /** + * Gets the proximityPlacementGroup property: Specifies information about the proximity placement group that the + * virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. + * + * @return the proximityPlacementGroup value. + */ + SubResource proximityPlacementGroup(); + + /** + * Gets the priority property: Specifies the priority for the virtual machine. <br><br>Minimum + * api-version: 2019-03-01. + * + * @return the priority value. + */ + VirtualMachinePriorityTypes priority(); + + /** + * Gets the evictionPolicy property: Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot + * scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and + * the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and + * 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + * + * @return the evictionPolicy value. + */ + VirtualMachineEvictionPolicyTypes evictionPolicy(); + + /** + * Gets the billingProfile property: Specifies the billing related details of a Azure Spot virtual machine. + * <br><br>Minimum api-version: 2019-03-01. + * + * @return the billingProfile value. + */ + BillingProfile billingProfile(); + + /** + * Gets the host property: Specifies information about the dedicated host that the virtual machine resides in. + * <br><br>Minimum api-version: 2018-10-01. + * + * @return the host value. + */ + SubResource host(); + + /** + * Gets the hostGroup property: Specifies information about the dedicated host group that the virtual machine + * resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify + * both host and hostGroup properties. + * + * @return the hostGroup value. + */ + SubResource hostGroup(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + VirtualMachineInstanceView instanceView(); + + /** + * Gets the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client + * <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: + * <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more + * information, see [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> + * Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + String licenseType(); + + /** + * Gets the vmId property: Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in + * all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default + * value is 90 minutes (PT1H30M). <br><br> Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + String extensionsTimeBudget(); + + /** + * Gets the platformFaultDomain property: Specifies the scale set logical fault domain into which the Virtual + * Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that + * best maintains balance across available fault domains.<br><li>This is applicable only if the + * 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is + * referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the + * Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance + * View.<br><br>Minimum api‐version: 2020‐12‐01. + * + * @return the platformFaultDomain value. + */ + Integer platformFaultDomain(); + + /** + * Gets the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + ScheduledEventsProfile scheduledEventsProfile(); + + /** + * Gets the userData property: UserData for the VM, which must be base-64 encoded. Customer should not pass any + * secrets in here. <br><br>Minimum api-version: 2021-03-01. + * + * @return the userData value. + */ + String userData(); + + /** + * Gets the capacityReservation property: Specifies information about the capacity reservation that is used to + * allocate virtual machine. <br><br>Minimum api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + CapacityReservationProfile capacityReservation(); + + /** + * Gets the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + ApplicationProfile applicationProfile(); + + /** + * Gets the timeCreated property: Specifies the time at which the Virtual Machine resource was + * created.<br><br>Minimum api-version: 2021-11-01. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the inner com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineUpdateInner object. + * + * @return the inner object. + */ + VirtualMachineUpdateInner innerModel(); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachines.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachines.java new file mode 100644 index 0000000000000..6804c05386b28 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VirtualMachines.java @@ -0,0 +1,773 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.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 VirtualMachines. */ +public interface VirtualMachines { + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + PagedIterable listByLocation(String location); + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the virtual machines under the specified subscription for the specified location. + */ + PagedIterable listByLocation(String location, Context context); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + VirtualMachineCaptureResult capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + + /** + * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar + * VMs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Capture Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of virtual machine capture operation. + */ + VirtualMachineCaptureResult capture( + String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, Boolean forceDeletion); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName); + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 vmName, Boolean forceDeletion, Context context); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + VirtualMachine getByResourceGroup(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String vmName, InstanceViewTypes expand, Context context); + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine. + */ + VirtualMachineInstanceView instanceView(String resourceGroupName, String vmName); + + /** + * Retrieves information about the run-time state of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instance view of a virtual machine along with {@link Response}. + */ + Response instanceViewWithResponse( + String resourceGroupName, String vmName, Context context); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToManagedDisks(String resourceGroupName, String vmName); + + /** + * Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before + * invoking this operation. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void convertToManagedDisks(String resourceGroupName, String vmName, Context context); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmName, Boolean hibernate); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmName); + + /** + * Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources + * that this virtual machine uses. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param hibernate Optional parameter to hibernate a virtual machine. (Feature in Preview). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deallocate(String resourceGroupName, String vmName, Boolean hibernate, Context context); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void generalize(String resourceGroupName, String vmName); + + /** + * Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before + * performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in + * Azure](https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource).<br>For Linux, + * please refer to [How to create an image of a virtual machine or + * VHD](https://docs.microsoft.com/azure/virtual-machines/linux/capture-image). + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response generalizeWithResponse(String resourceGroupName, String vmName, Context context); + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get + * the next page of virtual machines. + * + * @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + * @param filter The system query option to filter VMs returned in the response. Allowed value is + * 'virtualMachineScaleSet/id' eq + * /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable list(String statusOnly, String filter, Context context); + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listAvailableSizes(String resourceGroupName, String vmName); + + /** + * Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Virtual Machine operation response. + */ + PagedIterable listAvailableSizes(String resourceGroupName, String vmName, Context context); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmName, Boolean skipShutdown); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmName); + + /** + * The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same + * provisioned resources. You are still charged for this virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates + * non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + * specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void powerOff(String resourceGroupName, String vmName, Boolean skipShutdown, Context context); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reapply(String resourceGroupName, String vmName); + + /** + * The operation to reapply a virtual machine's state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reapply(String resourceGroupName, String vmName, Context context); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName); + + /** + * The operation to restart a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName, Context context); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName); + + /** + * The operation to start a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 resourceGroupName, String vmName, Context context); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmName); + + /** + * Shuts down the virtual machine, moves it to a new node, and powers it back on. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String vmName, Context context); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String vmName); + + /** + * Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Reimage Virtual Machine operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reimage(String resourceGroupName, String vmName, VirtualMachineReimageParameters parameters, Context context); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs. + */ + RetrieveBootDiagnosticsDataResult retrieveBootDiagnosticsData(String resourceGroupName, String vmName); + + /** + * The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to + * 1440 minutes. <br><br>NOTE: If not specified, SAS URIs will be generated with a default + * expiration duration of 120 minutes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}. + */ + Response retrieveBootDiagnosticsDataWithResponse( + String resourceGroupName, String vmName, Integer sasUriExpirationTimeInMinutes, Context context); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(String resourceGroupName, String vmName); + + /** + * The operation to perform maintenance on a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void performMaintenance(String resourceGroupName, String vmName, Context context); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void simulateEviction(String resourceGroupName, String vmName); + + /** + * The operation to simulate the eviction of spot virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown 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}. + */ + Response simulateEvictionWithResponse(String resourceGroupName, String vmName, Context context); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + VirtualMachineAssessPatchesResult assessPatches(String resourceGroupName, String vmName); + + /** + * Assess patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the properties of an AssessPatches result. + */ + VirtualMachineAssessPatchesResult assessPatches(String resourceGroupName, String vmName, Context context); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + VirtualMachineInstallPatchesResult installPatches( + String resourceGroupName, String vmName, VirtualMachineInstallPatchesParameters installPatchesInput); + + /** + * Installs patches on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param installPatchesInput Input for InstallPatches as directly received by the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result summary of an installation operation. + */ + VirtualMachineInstallPatchesResult installPatches( + String resourceGroupName, + String vmName, + VirtualMachineInstallPatchesParameters installPatchesInput, + Context context); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand(String resourceGroupName, String vmName, RunCommandInput parameters); + + /** + * Run command on the VM. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Run command operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + RunCommandResult runCommand(String resourceGroupName, String vmName, RunCommandInput parameters, Context context); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + VirtualMachine getById(String id); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param id the resource ID. + * @param expand The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime + * properties of the virtual machine that is managed by the platform and can change outside of control plane + * operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the + * user during the VM Create/Update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + Response getByIdWithResponse(String id, InstanceViewTypes expand, Context context); + + /** + * The operation to delete a virtual machine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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 machine. + * + * @param id the resource ID. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.compute.generated.models.ApiErrorException 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, Boolean forceDeletion, Context context); + + /** + * Begins definition for a new VirtualMachine resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachine definition. + */ + VirtualMachine.DefinitionStages.Blank define(String name); +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VmDiskTypes.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VmDiskTypes.java new file mode 100644 index 0000000000000..d587e52786d22 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/VmDiskTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VmDiskTypes. */ +public final class VmDiskTypes extends ExpandableStringEnum { + /** Static value None for VmDiskTypes. */ + public static final VmDiskTypes NONE = fromString("None"); + + /** Static value Unmanaged for VmDiskTypes. */ + public static final VmDiskTypes UNMANAGED = fromString("Unmanaged"); + + /** + * Creates or finds a VmDiskTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding VmDiskTypes. + */ + @JsonCreator + public static VmDiskTypes fromString(String name) { + return fromString(name, VmDiskTypes.class); + } + + /** @return known VmDiskTypes values. */ + public static Collection values() { + return values(VmDiskTypes.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMConfiguration.java new file mode 100644 index 0000000000000..7dd6e779a84fc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMConfiguration.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes Windows Remote Management configuration of the VM. */ +@Fluent +public final class WinRMConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WinRMConfiguration.class); + + /* + * The list of Windows Remote Management listeners + */ + @JsonProperty(value = "listeners") + private List listeners; + + /** + * Get the listeners property: The list of Windows Remote Management listeners. + * + * @return the listeners value. + */ + public List listeners() { + return this.listeners; + } + + /** + * Set the listeners property: The list of Windows Remote Management listeners. + * + * @param listeners the listeners value to set. + * @return the WinRMConfiguration object itself. + */ + public WinRMConfiguration withListeners(List listeners) { + this.listeners = listeners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (listeners() != null) { + listeners().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMListener.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMListener.java new file mode 100644 index 0000000000000..dd66aa9cc59f1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WinRMListener.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes Protocol and thumbprint of Windows Remote Management listener. */ +@Fluent +public final class WinRMListener { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WinRMListener.class); + + /* + * Specifies the protocol of WinRM listener.

    Possible values are: + *
    **http**

    **https** + */ + @JsonProperty(value = "protocol") + private ProtocolTypes protocol; + + /* + * This is the URL of a certificate that has been uploaded to Key Vault as + * a secret. For adding a secret to the Key Vault, see [Add a key or secret + * to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be It is the Base64 encoding of + * the following JSON Object which is encoded in UTF-8:

    {
    + * "data":"",
    "dataType":"pfx",
    + * "password":""
    }
    To install certificates on a + * virtual machine it is recommended to use the [Azure Key Vault virtual + * machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + @JsonProperty(value = "certificateUrl") + private String certificateUrl; + + /** + * Get the protocol property: Specifies the protocol of WinRM listener. <br><br> Possible values are: + * <br>**http** <br><br> **https**. + * + * @return the protocol value. + */ + public ProtocolTypes protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Specifies the protocol of WinRM listener. <br><br> Possible values are: + * <br>**http** <br><br> **https**. + * + * @param protocol the protocol value to set. + * @return the WinRMListener object itself. + */ + public WinRMListener withProtocol(ProtocolTypes protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate + * needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + * <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> + * "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates + * on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the certificateUrl value. + */ + public String certificateUrl() { + return this.certificateUrl; + } + + /** + * Set the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the key + * vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate + * needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + * <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> + * "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates + * on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault + * virtual machine extension for + * Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param certificateUrl the certificateUrl value to set. + * @return the WinRMListener object itself. + */ + public WinRMListener withCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsConfiguration.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsConfiguration.java new file mode 100644 index 0000000000000..b5150c6bb003e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsConfiguration.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies Windows operating system settings on the virtual machine. */ +@Fluent +public final class WindowsConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsConfiguration.class); + + /* + * Indicates whether virtual machine agent should be provisioned on the + * virtual machine.

    When this property is not specified in the + * request body, default behavior is to set it to true. This will ensure + * that VM Agent is installed on the VM so that extensions can be added to + * the VM later. + */ + @JsonProperty(value = "provisionVMAgent") + private Boolean provisionVMAgent; + + /* + * Indicates whether Automatic Updates is enabled for the Windows virtual + * machine. Default value is true.

    For virtual machine scale sets, + * this property can be updated and updates will take effect on OS + * reprovisioning. + */ + @JsonProperty(value = "enableAutomaticUpdates") + private Boolean enableAutomaticUpdates; + + /* + * Specifies the time zone of the virtual machine. e.g. "Pacific Standard + * Time".

    Possible values can be + * [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + * value from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /* + * Specifies additional base-64 encoded XML formatted information that can + * be included in the Unattend.xml file, which is used by Windows Setup. + */ + @JsonProperty(value = "additionalUnattendContent") + private List additionalUnattendContent; + + /* + * [Preview Feature] Specifies settings related to VM Guest Patching on + * Windows. + */ + @JsonProperty(value = "patchSettings") + private PatchSettings patchSettings; + + /* + * Specifies the Windows Remote Management listeners. This enables remote + * Windows PowerShell. + */ + @JsonProperty(value = "winRM") + private WinRMConfiguration winRM; + + /** + * Get the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. <br><br> When this property is not specified in the request body, default behavior is to set + * it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM + * later. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. <br><br> When this property is not specified in the request body, default behavior is to set + * it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM + * later. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual + * machine. Default value is true. <br><br> For virtual machine scale sets, this property can be updated + * and updates will take effect on OS reprovisioning. + * + * @return the enableAutomaticUpdates value. + */ + public Boolean enableAutomaticUpdates() { + return this.enableAutomaticUpdates; + } + + /** + * Set the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual + * machine. Default value is true. <br><br> For virtual machine scale sets, this property can be updated + * and updates will take effect on OS reprovisioning. + * + * @param enableAutomaticUpdates the enableAutomaticUpdates value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { + this.enableAutomaticUpdates = enableAutomaticUpdates; + return this; + } + + /** + * Get the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + * <br><br> Possible values can be + * [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value + * from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + * <br><br> Possible values can be + * [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value + * from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + * + * @param timeZone the timeZone value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that + * can be included in the Unattend.xml file, which is used by Windows Setup. + * + * @return the additionalUnattendContent value. + */ + public List additionalUnattendContent() { + return this.additionalUnattendContent; + } + + /** + * Set the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that + * can be included in the Unattend.xml file, which is used by Windows Setup. + * + * @param additionalUnattendContent the additionalUnattendContent value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withAdditionalUnattendContent( + List additionalUnattendContent) { + this.additionalUnattendContent = additionalUnattendContent; + return this; + } + + /** + * Get the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + * + * @return the patchSettings value. + */ + public PatchSettings patchSettings() { + return this.patchSettings; + } + + /** + * Set the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + * + * @param patchSettings the patchSettings value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withPatchSettings(PatchSettings patchSettings) { + this.patchSettings = patchSettings; + return this; + } + + /** + * Get the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows + * PowerShell. + * + * @return the winRM value. + */ + public WinRMConfiguration winRM() { + return this.winRM; + } + + /** + * Set the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows + * PowerShell. + * + * @param winRM the winRM value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withWinRM(WinRMConfiguration winRM) { + this.winRM = winRM; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (additionalUnattendContent() != null) { + additionalUnattendContent().forEach(e -> e.validate()); + } + if (patchSettings() != null) { + patchSettings().validate(); + } + if (winRM() != null) { + winRM().validate(); + } + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsParameters.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsParameters.java new file mode 100644 index 0000000000000..d3b8df865dcb7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsParameters.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Input for InstallPatches on a Windows VM, as directly received by the API. */ +@Fluent +public final class WindowsParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsParameters.class); + + /* + * The update classifications to select when installing patches for + * Windows. + */ + @JsonProperty(value = "classificationsToInclude") + private List classificationsToInclude; + + /* + * Kbs to include in the patch operation + */ + @JsonProperty(value = "kbNumbersToInclude") + private List kbNumbersToInclude; + + /* + * Kbs to exclude in the patch operation + */ + @JsonProperty(value = "kbNumbersToExclude") + private List kbNumbersToExclude; + + /* + * Filters out Kbs that don't have an InstallationRebootBehavior of + * 'NeverReboots' when this is set to true. + */ + @JsonProperty(value = "excludeKbsRequiringReboot") + private Boolean excludeKbsRequiringReboot; + + /* + * This is used to install patches that were published on or before this + * given max published date. + */ + @JsonProperty(value = "maxPatchPublishDate") + private OffsetDateTime maxPatchPublishDate; + + /** + * Get the classificationsToInclude property: The update classifications to select when installing patches for + * Windows. + * + * @return the classificationsToInclude value. + */ + public List classificationsToInclude() { + return this.classificationsToInclude; + } + + /** + * Set the classificationsToInclude property: The update classifications to select when installing patches for + * Windows. + * + * @param classificationsToInclude the classificationsToInclude value to set. + * @return the WindowsParameters object itself. + */ + public WindowsParameters withClassificationsToInclude( + List classificationsToInclude) { + this.classificationsToInclude = classificationsToInclude; + return this; + } + + /** + * Get the kbNumbersToInclude property: Kbs to include in the patch operation. + * + * @return the kbNumbersToInclude value. + */ + public List kbNumbersToInclude() { + return this.kbNumbersToInclude; + } + + /** + * Set the kbNumbersToInclude property: Kbs to include in the patch operation. + * + * @param kbNumbersToInclude the kbNumbersToInclude value to set. + * @return the WindowsParameters object itself. + */ + public WindowsParameters withKbNumbersToInclude(List kbNumbersToInclude) { + this.kbNumbersToInclude = kbNumbersToInclude; + return this; + } + + /** + * Get the kbNumbersToExclude property: Kbs to exclude in the patch operation. + * + * @return the kbNumbersToExclude value. + */ + public List kbNumbersToExclude() { + return this.kbNumbersToExclude; + } + + /** + * Set the kbNumbersToExclude property: Kbs to exclude in the patch operation. + * + * @param kbNumbersToExclude the kbNumbersToExclude value to set. + * @return the WindowsParameters object itself. + */ + public WindowsParameters withKbNumbersToExclude(List kbNumbersToExclude) { + this.kbNumbersToExclude = kbNumbersToExclude; + return this; + } + + /** + * Get the excludeKbsRequiringReboot property: Filters out Kbs that don't have an InstallationRebootBehavior of + * 'NeverReboots' when this is set to true. + * + * @return the excludeKbsRequiringReboot value. + */ + public Boolean excludeKbsRequiringReboot() { + return this.excludeKbsRequiringReboot; + } + + /** + * Set the excludeKbsRequiringReboot property: Filters out Kbs that don't have an InstallationRebootBehavior of + * 'NeverReboots' when this is set to true. + * + * @param excludeKbsRequiringReboot the excludeKbsRequiringReboot value to set. + * @return the WindowsParameters object itself. + */ + public WindowsParameters withExcludeKbsRequiringReboot(Boolean excludeKbsRequiringReboot) { + this.excludeKbsRequiringReboot = excludeKbsRequiringReboot; + return this; + } + + /** + * Get the maxPatchPublishDate property: This is used to install patches that were published on or before this given + * max published date. + * + * @return the maxPatchPublishDate value. + */ + public OffsetDateTime maxPatchPublishDate() { + return this.maxPatchPublishDate; + } + + /** + * Set the maxPatchPublishDate property: This is used to install patches that were published on or before this given + * max published date. + * + * @param maxPatchPublishDate the maxPatchPublishDate value to set. + * @return the WindowsParameters object itself. + */ + public WindowsParameters withMaxPatchPublishDate(OffsetDateTime maxPatchPublishDate) { + this.maxPatchPublishDate = maxPatchPublishDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsPatchAssessmentMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsPatchAssessmentMode.java new file mode 100644 index 0000000000000..db488817c4e3e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsPatchAssessmentMode.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WindowsPatchAssessmentMode. */ +public final class WindowsPatchAssessmentMode extends ExpandableStringEnum { + /** Static value ImageDefault for WindowsPatchAssessmentMode. */ + public static final WindowsPatchAssessmentMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** Static value AutomaticByPlatform for WindowsPatchAssessmentMode. */ + public static final WindowsPatchAssessmentMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates or finds a WindowsPatchAssessmentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsPatchAssessmentMode. + */ + @JsonCreator + public static WindowsPatchAssessmentMode fromString(String name) { + return fromString(name, WindowsPatchAssessmentMode.class); + } + + /** @return known WindowsPatchAssessmentMode values. */ + public static Collection values() { + return values(WindowsPatchAssessmentMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsVMGuestPatchMode.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsVMGuestPatchMode.java new file mode 100644 index 0000000000000..d91b8e7ba84e7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/WindowsVMGuestPatchMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WindowsVMGuestPatchMode. */ +public final class WindowsVMGuestPatchMode extends ExpandableStringEnum { + /** Static value Manual for WindowsVMGuestPatchMode. */ + public static final WindowsVMGuestPatchMode MANUAL = fromString("Manual"); + + /** Static value AutomaticByOS for WindowsVMGuestPatchMode. */ + public static final WindowsVMGuestPatchMode AUTOMATIC_BY_OS = fromString("AutomaticByOS"); + + /** Static value AutomaticByPlatform for WindowsVMGuestPatchMode. */ + public static final WindowsVMGuestPatchMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates or finds a WindowsVMGuestPatchMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsVMGuestPatchMode. + */ + @JsonCreator + public static WindowsVMGuestPatchMode fromString(String name) { + return fromString(name, WindowsVMGuestPatchMode.class); + } + + /** @return known WindowsVMGuestPatchMode values. */ + public static Collection values() { + return values(WindowsVMGuestPatchMode.class); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/package-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/package-info.java new file mode 100644 index 0000000000000..37e50ec14e516 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ComputeManagementClient. Compute Client. */ +package com.azure.resourcemanager.compute.generated.models; diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/package-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/package-info.java new file mode 100644 index 0000000000000..f96b736c986b5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/com/azure/resourcemanager/compute/generated/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ComputeManagementClient. Compute Client. */ +package com.azure.resourcemanager.compute.generated; diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/module-info.java b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..da13320a40242 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.compute.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.compute.generated; + exports com.azure.resourcemanager.compute.generated.fluent; + exports com.azure.resourcemanager.compute.generated.fluent.models; + exports com.azure.resourcemanager.compute.generated.models; + + opens com.azure.resourcemanager.compute.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.compute.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0b40b34d64437 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +/** Samples for AvailabilitySets CreateOrUpdate. */ +public final class AvailabilitySetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnAvailabilitySet.json + */ + /** + * Sample code: Create an availability set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnAvailabilitySet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .availabilitySets() + .define("myAvailabilitySet") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlatformUpdateDomainCount(20) + .withPlatformFaultDomainCount(2) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsDeleteSamples.java new file mode 100644 index 0000000000000..82c07b68ec757 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets Delete. */ +public final class AvailabilitySetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().deleteWithResponse("rgcompute", "aaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..fd09b000e6ac8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsGetByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets GetByResourceGroup. */ +public final class AvailabilitySetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Get_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListAvailableSizesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListAvailableSizesSamples.java new file mode 100644 index 0000000000000..ff1372a81e793 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListAvailableSizesSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListAvailableSizes. */ +public final class AvailabilitySetsListAvailableSizesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_ListAvailableSizes_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_ListAvailableSizes_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListAvailableSizesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listAvailableSizes("rgcompute", "aa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_ListAvailableSizes_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_ListAvailableSizes_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListAvailableSizesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listAvailableSizes("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..ef9fc3f150173 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListByResourceGroup. */ +public final class AvailabilitySetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_List_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_List_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().listByResourceGroup("rgcompute", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListSamples.java new file mode 100644 index 0000000000000..5802662dc2796 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets List. */ +public final class AvailabilitySetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListAvailabilitySetsInASubscription.json + */ + /** + * Sample code: List availability sets in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAvailabilitySetsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.availabilitySets().list("virtualMachines\\$ref", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsUpdateSamples.java new file mode 100644 index 0000000000000..72e5517fdcd35 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/AvailabilitySetsUpdateSamples.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AvailabilitySet; +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AvailabilitySets Update. */ +public final class AvailabilitySetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Update_MinimumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/AvailabilitySets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AvailabilitySets_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void availabilitySetsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaa", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key2574", "aaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .withPlatformUpdateDomainCount(20) + .withPlatformFaultDomainCount(2) + .withVirtualMachines( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withProximityPlacementGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ec2174402a7ea --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservationGroups CreateOrUpdate. */ +public final class CapacityReservationGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateACapacityReservationGroup.json + */ + /** + * Sample code: Create or update a capacity reservation group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateACapacityReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .define("myCapacityReservationGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1", "2")) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsDeleteSamples.java new file mode 100644 index 0000000000000..e956a0544368e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservationGroups Delete. */ +public final class CapacityReservationGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservationGroups().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservationGroups().deleteWithResponse("rgcompute", "a", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..5f88134318271 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservationGroups GetByResourceGroup. */ +public final class CapacityReservationGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetACapacityReservationGroup.json + */ + /** + * Sample code: Get a capacity reservation Group. + * + * @param manager Entry point to ComputeManager. + */ + public static void getACapacityReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myCapacityReservationGroup", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..b55fa93a235b0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups ListByResourceGroup. */ +public final class CapacityReservationGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationGroupsInResourceGroup.json + */ + /** + * Sample code: List capacity reservation groups in resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationGroupsInResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .listByResourceGroup( + "myResourceGroup", ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListSamples.java new file mode 100644 index 0000000000000..eff8597afc8c6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups List. */ +public final class CapacityReservationGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationGroupsInSubscription.json + */ + /** + * Sample code: List capacity reservation groups in subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationGroupsInSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservationGroups() + .list(ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsUpdateSamples.java new file mode 100644 index 0000000000000..ce83a159e7252 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationGroupsUpdateSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservationGroups Update. */ +public final class CapacityReservationGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservationGroup resource = + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key5355", "aaa")).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservationGroups_Update_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservationGroups_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationGroupsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservationGroup resource = + manager + .capacityReservationGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6453267df352a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservations CreateOrUpdate. */ +public final class CapacityReservationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateACapacityReservation.json + */ + /** + * Sample code: Create or update a capacity reservation . + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateACapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .define("myCapacityReservation") + .withRegion("westus") + .withExistingCapacityReservationGroup("myResourceGroup", "myCapacityReservationGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withCapacity(4L)) + .withTags(mapOf("department", "HR")) + .withZones(Arrays.asList("1")) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsDeleteSamples.java new file mode 100644 index 0000000000000..07813120195c4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservations Delete. */ +public final class CapacityReservationsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservations().delete("rgcompute", "aaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.capacityReservations().delete("rgcompute", "aaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsGetSamples.java new file mode 100644 index 0000000000000..b3a24c794d54b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservations Get. */ +public final class CapacityReservationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetACapacityReservation.json + */ + /** + * Sample code: Get a capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void getACapacityReservation(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .getWithResponse( + "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsListByCapacityReservationGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsListByCapacityReservationGroupSamples.java new file mode 100644 index 0000000000000..07feba7f49dae --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsListByCapacityReservationGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservations ListByCapacityReservationGroup. */ +public final class CapacityReservationsListByCapacityReservationGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListCapacityReservationsInReservationGroup.json + */ + /** + * Sample code: List capacity reservations in reservation group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCapacityReservationsInReservationGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .capacityReservations() + .listByCapacityReservationGroup("myResourceGroup", "myCapacityReservationGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsUpdateSamples.java new file mode 100644 index 0000000000000..fb2535e583c97 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CapacityReservationsUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CapacityReservation; +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservations Update. */ +public final class CapacityReservationsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Update_MinimumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservation resource = + manager + .capacityReservations() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CapacityReservations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CapacityReservations_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void capacityReservationsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CapacityReservation resource = + manager + .capacityReservations() + .getWithResponse("rgcompute", "aaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key4974", "aaaaaaaaaaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java new file mode 100644 index 0000000000000..c4ff2e8055ebc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSFamily. */ +public final class CloudServiceOperatingSystemsGetOSFamilySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSFamily.json + */ + /** + * Sample code: Get Cloud Service OS Family. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceOSFamily(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().getOSFamilyWithResponse("westus2", "3", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java new file mode 100644 index 0000000000000..1b7a84937b904 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSVersion. */ +public final class CloudServiceOperatingSystemsGetOSVersionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSVersion.json + */ + /** + * Sample code: Get Cloud Service OS Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceOSVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceOperatingSystems() + .getOSVersionWithResponse("westus2", "WA-GUEST-OS-3.90_202010-02", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java new file mode 100644 index 0000000000000..7cc0c7dc37eb5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSFamilies. */ +public final class CloudServiceOperatingSystemsListOSFamiliesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSFamilies.json + */ + /** + * Sample code: List Cloud Service OS Families in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServiceOSFamiliesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().listOSFamilies("westus2", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java new file mode 100644 index 0000000000000..b56740dc6edb8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSVersions. */ +public final class CloudServiceOperatingSystemsListOSVersionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSVersions.json + */ + /** + * Sample code: List Cloud Service OS Versions in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServiceOSVersionsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceOperatingSystems().listOSVersions("westus2", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesDeleteSamples.java new file mode 100644 index 0000000000000..ac420f08329a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Delete. */ +public final class CloudServiceRoleInstancesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstance.json + */ + /** + * Sample code: Delete Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().delete("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java new file mode 100644 index 0000000000000..850749a0f75c9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances GetInstanceView. */ +public final class CloudServiceRoleInstancesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetInstanceViewOfCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Instance View of Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInstanceViewOfCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceRoleInstances() + .getInstanceViewWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetSamples.java new file mode 100644 index 0000000000000..9536d190204dd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Get. */ +public final class CloudServiceRoleInstancesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceRoleInstance(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServiceRoleInstances() + .getWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesListSamples.java new file mode 100644 index 0000000000000..7ed232409a969 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances List. */ +public final class CloudServiceRoleInstancesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRolesInstances.json + */ + /** + * Sample code: List Role Instances in a Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRoleInstancesInACloudService( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().list("ConstosoRG", "{cs-name}", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRebuildSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRebuildSamples.java new file mode 100644 index 0000000000000..56c0489cf3440 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRebuildSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Rebuild. */ +public final class CloudServiceRoleInstancesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstance.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void rebuildCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().rebuild("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesReimageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesReimageSamples.java new file mode 100644 index 0000000000000..3ddd1e463e825 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesReimageSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Reimage. */ +public final class CloudServiceRoleInstancesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstance.json + */ + /** + * Sample code: Reimage Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().reimage("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRestartSamples.java new file mode 100644 index 0000000000000..5d581846e93ec --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRoleInstancesRestartSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Restart. */ +public final class CloudServiceRoleInstancesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstance.json + */ + /** + * Sample code: Restart Cloud Service Role Instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartCloudServiceRoleInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoleInstances().restart("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesGetSamples.java new file mode 100644 index 0000000000000..6a9459abd8240 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles Get. */ +public final class CloudServiceRolesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRole.json + */ + /** + * Sample code: Get Cloud Service Role. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceRole(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoles().getWithResponse("{role-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesListSamples.java new file mode 100644 index 0000000000000..0c3a67f95a6d6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServiceRolesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles List. */ +public final class CloudServiceRolesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRoles.json + */ + /** + * Sample code: List Roles in a Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRolesInACloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServiceRoles().list("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..564b0eda1c9c4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesCreateOrUpdateSamples.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.CloudServiceExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceExtensionProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceOsProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProfile; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleProfileProperties; +import com.azure.resourcemanager.compute.generated.models.CloudServiceRoleSku; +import com.azure.resourcemanager.compute.generated.models.CloudServiceUpgradeMode; +import com.azure.resourcemanager.compute.generated.models.CloudServiceVaultCertificate; +import com.azure.resourcemanager.compute.generated.models.CloudServiceVaultSecretGroup; +import com.azure.resourcemanager.compute.generated.models.Extension; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerConfiguration; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerConfigurationProperties; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerFrontendIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.LoadBalancerFrontendIpConfigurationProperties; +import java.util.Arrays; + +/** Samples for CloudServices CreateOrUpdate. */ +public final class CloudServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRole.json + */ + /** + * Sample code: Create New Cloud Service with Single Role. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRole( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("myLoadBalancer") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("myfe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP")))))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndCertificate.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and Certificate from Key Vault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withOsProfile( + new CloudServiceOsProfile() + .withSecrets( + Arrays + .asList( + new CloudServiceVaultSecretGroup() + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}")) + .withVaultCertificates( + Arrays + .asList( + new CloudServiceVaultCertificate() + .withCertificateUrl( + "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}")))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndRDP.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and RDP Extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithSingleRoleAndRDPExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"))))))))) + .withExtensionProfile( + new CloudServiceExtensionProfile() + .withExtensions( + Arrays + .asList( + new Extension() + .withName("RDPExtension") + .withProperties( + new CloudServiceExtensionProperties() + .withPublisher("Microsoft.Windows.Azure.Extensions") + .withType("RDP") + .withTypeHandlerVersion("1.2.1") + .withAutoUpgradeMinorVersion(false) + .withSettings( + "UserAzure10/22/2021" + + " 15:05:45") + .withProtectedSettings( + "{password}")))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithMultiRole.json + */ + /** + * Sample code: Create New Cloud Service with Multiple Roles. + * + * @param manager Entry point to ComputeManager. + */ + public static void createNewCloudServiceWithMultipleRoles( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .define("{cs-name}") + .withRegion("westus") + .withExistingResourceGroup("ConstosoRG") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L)), + new CloudServiceRoleProfileProperties() + .withName("ContosoBackend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteInstancesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteInstancesSamples.java new file mode 100644 index 0000000000000..74ba681caa70b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteInstancesSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices DeleteInstances. */ +public final class CloudServicesDeleteInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstances.json + */ + /** + * Sample code: Delete Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .deleteInstances( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteSamples.java new file mode 100644 index 0000000000000..51ad2ea6a71f9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices Delete. */ +public final class CloudServicesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudService.json + */ + /** + * Sample code: Delete Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().delete("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..1ab33f1a96431 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices GetByResourceGroup. */ +public final class CloudServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceWithMultiRoleAndRDP.json + */ + /** + * Sample code: Get Cloud Service with Multiple Roles and RDP Extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceWithMultipleRolesAndRDPExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().getByResourceGroupWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetInstanceViewSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetInstanceViewSamples.java new file mode 100644 index 0000000000000..bcd0e923e0b37 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesGetInstanceViewSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices GetInstanceView. */ +public final class CloudServicesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceInstanceViewWithMultiRole.json + */ + /** + * Sample code: Get Cloud Service Instance View with Multiple Roles. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceInstanceViewWithMultipleRoles( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().getInstanceViewWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..add9319eb6f54 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices ListByResourceGroup. */ +public final class CloudServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInResourceGroup.json + */ + /** + * Sample code: List Cloud Services in a Resource Group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServicesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().listByResourceGroup("ConstosoRG", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListSamples.java new file mode 100644 index 0000000000000..5b339e42fb62f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices List. */ +public final class CloudServicesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInSubscription.json + */ + /** + * Sample code: List Cloud Services in a Subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listCloudServicesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesPowerOffSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesPowerOffSamples.java new file mode 100644 index 0000000000000..8ac5d37083ef9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesPowerOffSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices PowerOff. */ +public final class CloudServicesPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/PowerOffCloudService.json + */ + /** + * Sample code: Stop or PowerOff Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void stopOrPowerOffCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().powerOff("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRebuildSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRebuildSamples.java new file mode 100644 index 0000000000000..766877416fc15 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRebuildSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Rebuild. */ +public final class CloudServicesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstances.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void rebuildCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .rebuild( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesReimageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesReimageSamples.java new file mode 100644 index 0000000000000..9eccf130da4cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesReimageSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Reimage. */ +public final class CloudServicesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstances.json + */ + /** + * Sample code: Reimage Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .reimage( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRestartSamples.java new file mode 100644 index 0000000000000..52be66fd3de3e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesRestartSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Restart. */ +public final class CloudServicesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstances.json + */ + /** + * Sample code: Restart Cloud Service Role Instances. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartCloudServiceRoleInstances( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .cloudServices() + .restart( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesStartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesStartSamples.java new file mode 100644 index 0000000000000..79bb538879239 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesStartSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices Start. */ +public final class CloudServicesStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/StartCloudService.json + */ + /** + * Sample code: Start Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void startCloudService(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServices().start("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java new file mode 100644 index 0000000000000..5a4238d4e03dc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain GetUpdateDomain. */ +public final class CloudServicesUpdateDomainGetUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceUpdateDomain.json + */ + /** + * Sample code: Get Cloud Service Update Domain. + * + * @param manager Entry point to ComputeManager. + */ + public static void getCloudServiceUpdateDomain(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().getUpdateDomainWithResponse("ConstosoRG", "{cs-name}", 1, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java new file mode 100644 index 0000000000000..ad1833f968f47 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain ListUpdateDomains. */ +public final class CloudServicesUpdateDomainListUpdateDomainsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceUpdateDomains.json + */ + /** + * Sample code: List Update Domains in Cloud Service. + * + * @param manager Entry point to ComputeManager. + */ + public static void listUpdateDomainsInCloudService( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().listUpdateDomains("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java new file mode 100644 index 0000000000000..fd65291616714 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain WalkUpdateDomain. */ +public final class CloudServicesUpdateDomainWalkUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceUpdateDomain.json + */ + /** + * Sample code: Update Cloud Service to specified Domain. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateCloudServiceToSpecifiedDomain( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.cloudServicesUpdateDomains().walkUpdateDomain("ConstosoRG", "{cs-name}", 1, null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateSamples.java new file mode 100644 index 0000000000000..f1f2d07015685 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CloudServicesUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CloudService; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudServices Update. */ +public final class CloudServicesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceToIncludeTags.json + */ + /** + * Sample code: Update existing Cloud Service to add tags. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateExistingCloudServiceToAddTags( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + CloudService resource = + manager.cloudServices().getByResourceGroupWithResponse("ConstosoRG", "{cs-name}", Context.NONE).getValue(); + resource.update().withTags(mapOf("Documentation", "RestAPI")).apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleriesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleriesGetSamples.java new file mode 100644 index 0000000000000..ab5f8ee2dcc1f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleriesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleries Get. */ +public final class CommunityGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.communityGalleries().getWithResponse("myLocation", "publicGalleryName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImageVersionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..1b5e13c298271 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImageVersionsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImageVersions Get. */ +public final class CommunityGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .communityGalleryImageVersions() + .getWithResponse( + "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImagesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImagesGetSamples.java new file mode 100644 index 0000000000000..1d87350f27e21 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/CommunityGalleryImagesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImages Get. */ +public final class CommunityGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .communityGalleryImages() + .getWithResponse("myLocation", "publicGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..af7a8747a8286 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHostGroups CreateOrUpdate. */ +public final class DedicatedHostGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateADedicatedHostGroup.json + */ + /** + * Sample code: Create or update a dedicated host group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateADedicatedHostGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHostGroups() + .define("myDedicatedHostGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1")) + .withPlatformFaultDomainCount(3) + .withSupportAutomaticPlacement(true) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ff65884e8a1ad --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups Delete. */ +public final class DedicatedHostGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().deleteWithResponse("rgcompute", "aaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().deleteWithResponse("rgcompute", "a", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..bdd1b26fbdb02 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups GetByResourceGroup. */ +public final class DedicatedHostGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetADedicatedHostGroup.json + */ + /** + * Sample code: Create a dedicated host group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADedicatedHostGroup(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myDedicatedHostGroup", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..b1b670d341c91 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups ListByResourceGroup. */ +public final class DedicatedHostGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListByResourceGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListByResourceGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().listByResourceGroup("rgcompute", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListSamples.java new file mode 100644 index 0000000000000..6e8f846e8c81c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups List. */ +public final class DedicatedHostGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_ListBySubscription_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsListBySubscriptionMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHostGroups().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsUpdateSamples.java new file mode 100644 index 0000000000000..9f9326d7e70fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostGroupsUpdateSamples.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostGroup; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHostGroups Update. */ +public final class DedicatedHostGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Update_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHostGroup resource = + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostGroups_Update_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHostGroups_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostGroupsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHostGroup resource = + manager + .dedicatedHostGroups() + .getByResourceGroupWithResponse("rgcompute", "aaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key9921", "aaaaaaaaaa")) + .withZones(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .withPlatformFaultDomainCount(3) + .withSupportAutomaticPlacement(true) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..80c551ac18738 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsCreateOrUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHosts CreateOrUpdate. */ +public final class DedicatedHostsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateADedicatedHost.json + */ + /** + * Sample code: Create or update a dedicated host . + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateADedicatedHost( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHosts() + .define("myDedicatedHost") + .withRegion("westus") + .withExistingHostGroup("myResourceGroup", "myDedicatedHostGroup") + .withSku(new Sku().withName("DSv3-Type1")) + .withTags(mapOf("department", "HR")) + .withPlatformFaultDomain(1) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsDeleteSamples.java new file mode 100644 index 0000000000000..8e0461045f9b6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Delete. */ +public final class DedicatedHostsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().delete("rgcompute", "aaaaaa", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().delete("rgcompute", "aaaaaaaaaaaaaaa", "aaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsGetSamples.java new file mode 100644 index 0000000000000..57756789431f3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Get. */ +public final class DedicatedHostsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetADedicatedHost.json + */ + /** + * Sample code: Get a dedicated host. + * + * @param manager Entry point to ComputeManager. + */ + public static void getADedicatedHost(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .dedicatedHosts() + .getWithResponse("myResourceGroup", "myDedicatedHostGroup", "myHost", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsListByHostGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsListByHostGroupSamples.java new file mode 100644 index 0000000000000..e26e5a8dc2073 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsListByHostGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts ListByHostGroup. */ +public final class DedicatedHostsListByHostGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_ListByHostGroup_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_ListByHostGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsListByHostGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().listByHostGroup("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_ListByHostGroup_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_ListByHostGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsListByHostGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().listByHostGroup("rgcompute", "aaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsRestartSamples.java new file mode 100644 index 0000000000000..8ccde92c718b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsRestartSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Restart. */ +public final class DedicatedHostsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHostRestart.json + */ + /** + * Sample code: Restart Dedicated Host. + * + * @param manager Entry point to ComputeManager. + */ + public static void restartDedicatedHost(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.dedicatedHosts().restart("myResourceGroup", "myDedicatedHostGroup", "myHost", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsUpdateSamples.java new file mode 100644 index 0000000000000..6af53a5c0edfc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DedicatedHostsUpdateSamples.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DedicatedHost; +import com.azure.resourcemanager.compute.generated.models.DedicatedHostLicenseTypes; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHosts Update. */ +public final class DedicatedHostsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Update_MaximumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHost resource = + manager + .dedicatedHosts() + .getWithResponse("rgcompute", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key8813", "aaaaaaaaaaaaaaaaaaaaaaaaaaa")) + .withPlatformFaultDomain(1) + .withAutoReplaceOnFailure(true) + .withLicenseType(DedicatedHostLicenseTypes.WINDOWS_SERVER_HYBRID) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DedicatedHosts_Update_MinimumSet_Gen.json + */ + /** + * Sample code: DedicatedHosts_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void dedicatedHostsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DedicatedHost resource = + manager + .dedicatedHosts() + .getWithResponse("rgcompute", "aa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..832f39ba73d9d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +/** Samples for DiskAccesses CreateOrUpdate. */ +public final class DiskAccessesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskAccess.json + */ + /** + * Sample code: Create a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .define("myDiskAccess") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..4873323155ebe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses DeleteAPrivateEndpointConnection. */ +public final class DiskAccessesDeleteAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteAPrivateEndpointConnection.json + */ + /** + * Sample code: Delete a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .deleteAPrivateEndpointConnection( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteSamples.java new file mode 100644 index 0000000000000..e2167eac3094e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses Delete. */ +public final class DiskAccessesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteADiskAccess.json + */ + /** + * Sample code: Delete a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().delete("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..973b3c1f016eb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetAPrivateEndpointConnection. */ +public final class DiskAccessesGetAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutAPrivateEndpointConnection.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .getAPrivateEndpointConnectionWithResponse( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b65952f8a048a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetByResourceGroup. */ +public final class DiskAccessesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskAccess.json + */ + /** + * Sample code: Get information about a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskAccessWithPrivateEndpoints.json + */ + /** + * Sample code: Get information about a disk access resource with private endpoints. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskAccessResourceWithPrivateEndpoints( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetPrivateLinkResourcesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetPrivateLinkResourcesSamples.java new file mode 100644 index 0000000000000..65b711889739e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesGetPrivateLinkResourcesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetPrivateLinkResources. */ +public final class DiskAccessesGetPrivateLinkResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskAccessPrivateLinkResources.json + */ + /** + * Sample code: List all possible private link resources under disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllPossiblePrivateLinkResourcesUnderDiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().getPrivateLinkResourcesWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..be51aefd8dac4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListByResourceGroup. */ +public final class DiskAccessesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskAccessesInAResourceGroup.json + */ + /** + * Sample code: List all disk access resources in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskAccessResourcesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java new file mode 100644 index 0000000000000..62ca22e810d32 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListPrivateEndpointConnections. */ +public final class DiskAccessesListPrivateEndpointConnectionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListPrivateEndpointConnectionsInADiskAccess.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().listPrivateEndpointConnections("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListSamples.java new file mode 100644 index 0000000000000..8afb33c300add --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses List. */ +public final class DiskAccessesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskAccessesInASubscription.json + */ + /** + * Sample code: List all disk access resources in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskAccessResourcesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskAccesses().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..7af1994182d48 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.generated.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.compute.generated.models.PrivateLinkServiceConnectionState; + +/** Samples for DiskAccesses UpdateAPrivateEndpointConnection. */ +public final class DiskAccessesUpdateAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ApprovePrivateEndpointConnection.json + */ + /** + * Sample code: Approve a Private Endpoint Connection under a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void approveAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskAccesses() + .updateAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approving myPrivateEndpointConnection")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateSamples.java new file mode 100644 index 0000000000000..9fd9f26cc8f86 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskAccessesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DiskAccess; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskAccesses Update. */ +public final class DiskAccessesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskAccess.json + */ + /** + * Sample code: Update a disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskAccessResource(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskAccess resource = + manager + .diskAccesses() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Development", "project", "PrivateEndpoints")).apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fb72b79f6a753 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsCreateOrUpdateSamples.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.SourceVault; + +/** Samples for DiskEncryptionSets CreateOrUpdate. */ +public final class DiskEncryptionSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskEncryptionSet.json + */ + /** + * Sample code: Create a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .define("myDiskEncryptionSet") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/{key}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateADiskEncryptionSetWithKeyVaultFromADifferentSubscription.json + */ + /** + * Sample code: Create a disk encryption set with key vault from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createADiskEncryptionSetWithKeyVaultFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .define("myDiskEncryptionSet") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}")) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsDeleteSamples.java new file mode 100644 index 0000000000000..bf7449b3d5ff2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets Delete. */ +public final class DiskEncryptionSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteADiskEncryptionSet.json + */ + /** + * Sample code: Delete a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().delete("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..abe788d178494 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsGetByResourceGroupSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets GetByResourceGroup. */ +public final class DiskEncryptionSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskEncryptionSet.json + */ + /** + * Sample code: Get information about a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutADiskEncryptionSetWithAutoKeyRotationError.json + */ + /** + * Sample code: Get information about a disk encryption set when auto-key rotation failed. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java new file mode 100644 index 0000000000000..afab541e49b40 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListAssociatedResources. */ +public final class DiskEncryptionSetsListAssociatedResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetAssociatedResources.json + */ + /** + * Sample code: List all resources that are encrypted with this disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().listAssociatedResources("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..00a0a42a5eea8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListByResourceGroup. */ +public final class DiskEncryptionSetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ + /** + * Sample code: List all disk encryption sets in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskEncryptionSetsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListSamples.java new file mode 100644 index 0000000000000..407d789e558a7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets List. */ +public final class DiskEncryptionSetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskEncryptionSetsInASubscription.json + */ + /** + * Sample code: List all disk encryption sets in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllDiskEncryptionSetsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskEncryptionSets().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsUpdateSamples.java new file mode 100644 index 0000000000000..d87be97b74bbd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskEncryptionSetsUpdateSamples.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.generated.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.generated.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.generated.models.SourceVault; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskEncryptionSets Update. */ +public final class DiskEncryptionSetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabled.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Succeeded. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledInProgress.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Updating. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateADiskEncryptionSet.json + */ + /** + * Sample code: Update a disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateADiskEncryptionSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + DiskEncryptionSet resource = + manager + .diskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "Encryption")) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion")) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGetSamples.java new file mode 100644 index 0000000000000..0cda72817c8c7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGetSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint Get. */ +public final class DiskRestorePointGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskRestorePointWhenSourceResourceIsFromDifferentRegion.json + */ + /** + * Sample code: Get an incremental disk restorePoint when source resource is from a different region. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .getWithResponse( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetDiskRestorePointResources.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .getWithResponse( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGrantAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGrantAccessSamples.java new file mode 100644 index 0000000000000..edcc45f76cb1c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointGrantAccessSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for DiskRestorePoint GrantAccess. */ +public final class DiskRestorePointGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Grants access to a diskRestorePoint. + * + * @param manager Entry point to ComputeManager. + */ + public static void grantsAccessToADiskRestorePoint( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .grantAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointListByRestorePointSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointListByRestorePointSamples.java new file mode 100644 index 0000000000000..e80e382db8a01 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointListByRestorePointSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint ListByRestorePoint. */ +public final class DiskRestorePointListByRestorePointSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListDiskRestorePointsInVmRestorePoint.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnIncrementalDiskRestorePointResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.diskRestorePoints().listByRestorePoint("myResourceGroup", "rpc", "vmrp", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointRevokeAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointRevokeAccessSamples.java new file mode 100644 index 0000000000000..7594ff5ff86c2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DiskRestorePointRevokeAccessSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint RevokeAccess. */ +public final class DiskRestorePointRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Revokes access to a diskRestorePoint. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokesAccessToADiskRestorePoint( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .diskRestorePoints() + .revokeAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..54e2748d33870 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksCreateOrUpdateSamples.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOption; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.DiskSecurityTypes; +import com.azure.resourcemanager.compute.generated.models.DiskSku; +import com.azure.resourcemanager.compute.generated.models.DiskStorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.Encryption; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocation; +import com.azure.resourcemanager.compute.generated.models.ExtendedLocationTypes; +import com.azure.resourcemanager.compute.generated.models.ImageDiskReference; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for Disks CreateOrUpdate. */ +public final class DisksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromImportSecure.json + */ + /** + * Sample code: Create a managed disk from ImportSecure create option. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromImportSecureCreateOption( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT_SECURE) + .withStorageAccountId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withSecurityDataUri("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd")) + .withSecurityProfile( + new DiskSecurityProfile() + .withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithDiskAccess.json + */ + /** + * Sample code: Create a managed disk and associate with disk access resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskAndAssociateWithDiskAccessResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_PRIVATE) + .withDiskAccessId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a managed disk and associate with disk encryption set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskAndAssociateWithDiskEncryptionSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withEncryption( + new Encryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ + /** + * Sample code: Create a managed disk from an existing managed disk in the same or different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithSecurityProfile.json + */ + /** + * Sample code: Create a managed disk with security profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskWithSecurityProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("North Central US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"))) + .withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithLogicalSectorSize.json + */ + /** + * Sample code: Create an ultra managed disk with logicalSectorSize 512E. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnUltraManagedDiskWithLogicalSectorSize512E( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.ULTRA_SSD_LRS)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY).withLogicalSectorSize(512)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ + /** + * Sample code: Create a managed disk from a platform image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromAPlatformImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAnEmptyManagedDisk.json + */ + /** + * Sample code: Create an empty managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnEmptyManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from the same subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskFromUploadPreparedSecure.json + */ + /** + * Sample code: Create a managed disk from UploadPreparedSecure create option. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskFromUploadPreparedSecureCreateOption( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.UPLOAD_PREPARED_SECURE) + .withUploadSizeBytes(10737418752L)) + .withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ + /** + * Sample code: Create a managed disk by copying a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskByCopyingASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAConfidentialVMDiskEncryptedWithCMK.json + */ + /** + * Sample code: Create a confidential VM supported disk encrypted with customer managed key. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))) + .withSecurityProfile( + new DiskSecurityProfile() + .withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_CUSTOMER_KEY) + .withSecureVMDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedDiskWithSSDZRSAccountType.json + */ + /** + * Sample code: Create a managed disk with ssd zrs account type. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedDiskWithSsdZrsAccountType( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.PREMIUM_ZRS)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAnEmptyManagedDiskInExtendedLocation.json + */ + /** + * Sample code: Create an empty managed disk in extended location. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAnEmptyManagedDiskInExtendedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation( + new ExtendedLocation().withName("{edge-zone-id}").withType(ExtendedLocationTypes.EDGE_ZONE)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateAManagedUploadDisk.json + */ + /** + * Sample code: Create a managed upload disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAManagedUploadDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .define("myDisk") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData().withCreateOption(DiskCreateOption.UPLOAD).withUploadSizeBytes(10737418752L)) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksDeleteSamples.java new file mode 100644 index 0000000000000..862a6de9e365e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks Delete. */ +public final class DisksDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteAManagedDisk.json + */ + /** + * Sample code: Delete a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().delete("myResourceGroup", "myDisk", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6f73c873aeff6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks GetByResourceGroup. */ +public final class DisksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutAManagedDisk.json + */ + /** + * Sample code: Get information about a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myManagedDisk", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGrantAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGrantAccessSamples.java new file mode 100644 index 0000000000000..e148394798937 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksGrantAccessSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for Disks GrantAccess. */ +public final class DisksGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessManagedDisk.json + */ + /** + * Sample code: Get a sas on a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void getASasOnAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .grantAccess( + "myResourceGroup", + "myDisk", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessManagedDiskWithVMGuestState.json + */ + /** + * Sample code: Get sas on managed disk and VM guest state. + * + * @param manager Entry point to ComputeManager. + */ + public static void getSasOnManagedDiskAndVMGuestState( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .disks() + .grantAccess( + "myResourceGroup", + "myDisk", + new GrantAccessData() + .withAccess(AccessLevel.READ) + .withDurationInSeconds(300) + .withGetSecureVMGuestStateSas(true), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListByResourceGroupSamples.java new file mode 100644 index 0000000000000..31a7b5f8de9c6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks ListByResourceGroup. */ +public final class DisksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListManagedDisksInAResourceGroup.json + */ + /** + * Sample code: List all managed disks in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllManagedDisksInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListSamples.java new file mode 100644 index 0000000000000..4861304c3d779 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks List. */ +public final class DisksListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListManagedDisksInASubscription.json + */ + /** + * Sample code: List all managed disks in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllManagedDisksInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksRevokeAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksRevokeAccessSamples.java new file mode 100644 index 0000000000000..4da5710ba06ce --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksRevokeAccessSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks RevokeAccess. */ +public final class DisksRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessManagedDisk.json + */ + /** + * Sample code: Revoke access to a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokeAccessToAManagedDisk(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.disks().revokeAccess("myResourceGroup", "myDisk", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksUpdateSamples.java new file mode 100644 index 0000000000000..d1b483d1ce6e7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/DisksUpdateSamples.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Disk; +import com.azure.resourcemanager.compute.generated.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.generated.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; + +/** Samples for Disks Update. */ +public final class DisksUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToDisableBursting.json + */ + /** + * Sample code: Update a managed disk to disable bursting. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToDisableBursting( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withBurstingEnabled(false).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddPurchasePlan.json + */ + /** + * Sample code: Update a managed disk to add purchase plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddPurchasePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource + .update() + .withPurchasePlan( + new PurchasePlanAutoGenerated() + .withName("myPurchasePlanName") + .withPublisher("myPurchasePlanPublisher") + .withProduct("myPurchasePlanProduct") + .withPromotionCode("myPurchasePlanPromotionCode")) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToChangeTier.json + */ + /** + * Sample code: Update a managed disk to change tier. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToChangeTier( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withTier("P30").apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateOrUpdateABurstingEnabledManagedDisk.json + */ + /** + * Sample code: Create or update a bursting enabled managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateABurstingEnabledManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withDiskSizeGB(1024).withBurstingEnabled(true).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddSupportsHibernation.json + */ + /** + * Sample code: Update a managed disk to add supportsHibernation. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddSupportsHibernation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withSupportsHibernation(true).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToRemoveDiskAccess.json + */ + /** + * Sample code: Update managed disk to remove disk access resource association. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateManagedDiskToRemoveDiskAccessResourceAssociation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_ALL).apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateAManagedDiskToAddAcceleratedNetworking.json + */ + /** + * Sample code: Update a managed disk to add accelerated networking. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAManagedDiskToAddAcceleratedNetworking( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Disk resource = + manager.disks().getByResourceGroupWithResponse("myResourceGroup", "myDisk", Context.NONE).getValue(); + resource.update().withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)).apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..93b8b35e54031 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesCreateOrUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.GallerySharingPermissionTypes; +import com.azure.resourcemanager.compute.generated.models.SharingProfile; +import com.azure.resourcemanager.compute.generated.models.SoftDeletePolicy; + +/** Samples for Galleries CreateOrUpdate. */ +public final class GalleriesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSharingProfile.json + */ + /** + * Sample code: Create or update a simple gallery with sharing profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryWithSharingProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .withSharingProfile(new SharingProfile().withPermissions(GallerySharingPermissionTypes.GROUPS)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGallery.json + */ + /** + * Sample code: Create or update a simple gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSoftDeletionEnabled.json + */ + /** + * Sample code: Create or update a simple gallery with soft deletion enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryWithSoftDeletionEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .define("myGalleryName") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withDescription("This is the gallery description.") + .withSoftDeletePolicy(new SoftDeletePolicy().withIsSoftDeleteEnabled(true)) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesDeleteSamples.java new file mode 100644 index 0000000000000..4aea8c4f7daf1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries Delete. */ +public final class GalleriesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGallery.json + */ + /** + * Sample code: Delete a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().delete("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..2bbcaa66eb91f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesGetByResourceGroupSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.SelectPermissions; + +/** Samples for Galleries GetByResourceGroup. */ +public final class GalleriesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryWithSelectPermissions.json + */ + /** + * Sample code: Get a gallery with select permissions. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryWithSelectPermissions( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleries() + .getByResourceGroupWithResponse( + "myResourceGroup", "myGalleryName", SelectPermissions.PERMISSIONS, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().getByResourceGroupWithResponse("myResourceGroup", "myGalleryName", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..9523a869b7b2c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries ListByResourceGroup. */ +public final class GalleriesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInAResourceGroup.json + */ + /** + * Sample code: List galleries in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleriesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListSamples.java new file mode 100644 index 0000000000000..9f0e5d96b69d2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries List. */ +public final class GalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInASubscription.json + */ + /** + * Sample code: List galleries in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleriesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleries().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesUpdateSamples.java new file mode 100644 index 0000000000000..ac9942cd72694 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleriesUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Gallery; + +/** Samples for Galleries Update. */ +public final class GalleriesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGallery.json + */ + /** + * Sample code: Update a simple gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Gallery resource = + manager + .galleries() + .getByResourceGroupWithResponse("myResourceGroup", "myGalleryName", null, Context.NONE) + .getValue(); + resource.update().withDescription("This is the gallery description.").apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dec01198b9483 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import com.azure.resourcemanager.compute.generated.models.UserArtifactManage; +import com.azure.resourcemanager.compute.generated.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions CreateOrUpdate. */ +public final class GalleryApplicationVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Create or update a simple gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingApplication("myResourceGroup", "myGalleryName", "myGalleryApplicationName") + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\"") + .withRemove("del C:\\package "))) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsDeleteSamples.java new file mode 100644 index 0000000000000..f64a913c033c1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions Delete. */ +public final class GalleryApplicationVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplicationVersion.json + */ + /** + * Sample code: Delete a gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsGetSamples.java new file mode 100644 index 0000000000000..856402a61b169 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsGetSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; + +/** Samples for GalleryApplicationVersions Get. */ +public final class GalleryApplicationVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersion.json + */ + /** + * Sample code: Get a gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery Application Version with replication status. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplicationVersionWithReplicationStatus( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java new file mode 100644 index 0000000000000..959f554ae7000 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions ListByGalleryApplication. */ +public final class GalleryApplicationVersionsListByGalleryApplicationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationVersionsInAGalleryApplication.json + */ + /** + * Sample code: List gallery Application Versions in a gallery Application Definition. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryApplicationVersionsInAGalleryApplicationDefinition( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplicationVersions() + .listByGalleryApplication("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsUpdateSamples.java new file mode 100644 index 0000000000000..b42218cddb58d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationVersionsUpdateSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import com.azure.resourcemanager.compute.generated.models.UserArtifactManage; +import com.azure.resourcemanager.compute.generated.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions Update. */ +public final class GalleryApplicationVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Update a simple gallery Application Version. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryApplicationVersion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryApplicationVersion resource = + manager + .galleryApplicationVersions() + .getWithResponse( + "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath C:\\package\"") + .withRemove("del C:\\package "))) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5647fd4bf2a19 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryApplications CreateOrUpdate. */ +public final class GalleryApplicationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Create or update a simple gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryApplication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .define("myGalleryApplicationName") + .withRegion("West US") + .withExistingGallery("myResourceGroup", "myGalleryName") + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsDeleteSamples.java new file mode 100644 index 0000000000000..25ac3e45a0127 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Delete. */ +public final class GalleryApplicationsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplication.json + */ + /** + * Sample code: Delete a gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryApplication(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsGetSamples.java new file mode 100644 index 0000000000000..863583018406a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Get. */ +public final class GalleryApplicationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplication.json + */ + /** + * Sample code: Get a gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryApplication(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryApplications() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsListByGallerySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsListByGallerySamples.java new file mode 100644 index 0000000000000..7463fa116016f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsListByGallerySamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications ListByGallery. */ +public final class GalleryApplicationsListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationsInAGallery.json + */ + /** + * Sample code: List gallery Applications in a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryApplicationsInAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryApplications().listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsUpdateSamples.java new file mode 100644 index 0000000000000..f55a5ca6d6718 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryApplicationsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryApplication; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryApplications Update. */ +public final class GalleryApplicationsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Update a simple gallery Application. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryApplication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryApplication resource = + manager + .galleryApplications() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE) + .getValue(); + resource + .update() + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e5ada23ec0121 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsCreateOrUpdateSamples.java @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.DataDiskImageEncryption; +import com.azure.resourcemanager.compute.generated.models.EncryptionImages; +import com.azure.resourcemanager.compute.generated.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.generated.models.GalleryDataDiskImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryOSDiskImage; +import com.azure.resourcemanager.compute.generated.models.HostCaching; +import com.azure.resourcemanager.compute.generated.models.OSDiskImageEncryption; +import com.azure.resourcemanager.compute.generated.models.ReplicationMode; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions CreateOrUpdate. */ +public final class GalleryImageVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithShallowReplicationMode.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shallow replication mode. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays.asList(new TargetRegion().withName("West US").withRegionalReplicaCount(1))) + .withReplicationMode(ReplicationMode.SHALLOW)) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVHD.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using vhd as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVMAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using VM as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVMAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithImageVersionAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shared image as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using mix of disks and snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using managed image as source. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .define("1.0.0") + .withRegion("West US") + .withExistingImage("myResourceGroup", "myGalleryName", "myGalleryImageName") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsDeleteSamples.java new file mode 100644 index 0000000000000..603b2497c1706 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions Delete. */ +public final class GalleryImageVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImageVersion.json + */ + /** + * Sample code: Delete a gallery image version. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryImageVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..e1772add46352 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsGetSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ReplicationStatusTypes; + +/** Samples for GalleryImageVersions Get. */ +public final class GalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithVhdAsSource.json + */ + /** + * Sample code: Get a gallery image version with vhd as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithVhdAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery image version. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersion(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery image version with replication status. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithReplicationStatus( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Get a gallery image version with snapshots as a source. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImageVersionWithSnapshotsAsASource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsListByGalleryImageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsListByGalleryImageSamples.java new file mode 100644 index 0000000000000..c3c869e4ded82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsListByGalleryImageSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions ListByGalleryImage. */ +public final class GalleryImageVersionsListByGalleryImageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImageVersionsInAGalleryImage.json + */ + /** + * Sample code: List gallery image versions in a gallery image definition. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryImageVersionsInAGalleryImageDefinition( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImageVersions() + .listByGalleryImage("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsUpdateSamples.java new file mode 100644 index 0000000000000..662f17f9c6481 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImageVersionsUpdateSamples.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersion; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.generated.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountType; +import com.azure.resourcemanager.compute.generated.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions Update. */ +public final class GalleryImageVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Update a simple Gallery Image Version (Managed Image as source). + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImageVersionManagedImageAsSource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImageVersion resource = + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersionWithoutSourceId.json + */ + /** + * Sample code: Update a simple Gallery Image Version without source id. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImageVersionWithoutSourceId( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImageVersion resource = + manager + .galleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE) + .getValue(); + resource + .update() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile(new GalleryImageVersionStorageProfile()) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6f3a184f244ba --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryImages CreateOrUpdate. */ +public final class GalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImage.json + */ + /** + * Sample code: Create or update a simple gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateASimpleGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .galleryImages() + .define("myGalleryImageName") + .withRegion("West US") + .withExistingGallery("myResourceGroup", "myGalleryName") + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesDeleteSamples.java new file mode 100644 index 0000000000000..38354849a490e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages Delete. */ +public final class GalleryImagesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImage.json + */ + /** + * Sample code: Delete a gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteAGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().delete("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesGetSamples.java new file mode 100644 index 0000000000000..7545b5d37b93f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages Get. */ +public final class GalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImage.json + */ + /** + * Sample code: Get a gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesListByGallerySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesListByGallerySamples.java new file mode 100644 index 0000000000000..6ce3093665784 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesListByGallerySamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages ListByGallery. */ +public final class GalleryImagesListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImagesInAGallery.json + */ + /** + * Sample code: List gallery images in a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void listGalleryImagesInAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.galleryImages().listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesUpdateSamples.java new file mode 100644 index 0000000000000..62c9ad3f9f4a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GalleryImagesUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.GalleryImage; +import com.azure.resourcemanager.compute.generated.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.generated.models.HyperVGeneration; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; + +/** Samples for GalleryImages Update. */ +public final class GalleryImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImage.json + */ + /** + * Sample code: Update a simple gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASimpleGalleryImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + GalleryImage resource = + manager + .galleryImages() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE) + .getValue(); + resource + .update() + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GallerySharingProfileUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GallerySharingProfileUpdateSamples.java new file mode 100644 index 0000000000000..231d6e434f43a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/GallerySharingProfileUpdateSamples.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroup; +import com.azure.resourcemanager.compute.generated.models.SharingProfileGroupTypes; +import com.azure.resourcemanager.compute.generated.models.SharingUpdateOperationTypes; +import java.util.Arrays; + +/** Samples for GallerySharingProfile Update. */ +public final class GallerySharingProfileUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ResetSharingProfileInAGallery.json + */ + /** + * Sample code: reset sharing profile of a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void resetSharingProfileOfAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .gallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner().withOperationType(SharingUpdateOperationTypes.RESET), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/AddToSharingProfileInAGallery.json + */ + /** + * Sample code: Add sharing id to the sharing profile of a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void addSharingIdToTheSharingProfileOfAGallery( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .gallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner() + .withOperationType(SharingUpdateOperationTypes.ADD) + .withGroups( + Arrays + .asList( + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.SUBSCRIPTIONS) + .withIds( + Arrays + .asList( + "34a4ab42-0d72-47d9-bd1a-aed207386dac", + "380fd389-260b-41aa-bad9-0a83108c370b")), + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.AADTENANTS) + .withIds(Arrays.asList("c24c76aa-8897-4027-9b03-8f7928b54ff6")))), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b4018ac97ac75 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesCreateOrUpdateSamples.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageDataDisk; +import com.azure.resourcemanager.compute.generated.models.ImageOSDisk; +import com.azure.resourcemanager.compute.generated.models.ImageStorageProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import java.util.Arrays; + +/** Samples for Images CreateOrUpdate. */ +public final class ImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(false)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a blob with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromABlob.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a blob. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromABlob( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withBlobUri( + "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd") + .withLun(1))) + .withZoneResilient(false)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot with DiskEncryptionSet resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2")) + .withLun(1))) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromABlob.json + */ + /** + * Sample code: Create a virtual machine image from a blob. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromABlob( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageFromAVM.json + */ + /** + * Sample code: Create a virtual machine image from an existing virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageFromAnExistingVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a managed disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .images() + .define("myImage") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2")) + .withLun(1))) + .withZoneResilient(false)) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesDeleteSamples.java new file mode 100644 index 0000000000000..b833b2af83abe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesDeleteSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Images Delete. */ +public final class ImagesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Images_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Images_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void imagesDeleteMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Images_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Images_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void imagesDeleteMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..97e30590ecb49 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Images GetByResourceGroup. */ +public final class ImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetInformationAboutAnImage.json + */ + /** + * Sample code: Get information about a virtual machine image. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutAVirtualMachineImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().getByResourceGroupWithResponse("myResourceGroup", "myImage", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..630084a92297e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Images ListByResourceGroup. */ +public final class ImagesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListImagesInAResourceGroup.json + */ + /** + * Sample code: List all virtual machine images in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllVirtualMachineImagesInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListSamples.java new file mode 100644 index 0000000000000..5668cee0bd868 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Images List. */ +public final class ImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListImagesInASubscription.json + */ + /** + * Sample code: List all virtual machine images in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllVirtualMachineImagesInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.images().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesUpdateSamples.java new file mode 100644 index 0000000000000..a93e4e4532d81 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ImagesUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.generated.models.Image; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Images Update. */ +public final class ImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateImage.json + */ + /** + * Sample code: Updates tags of an Image. + * + * @param manager Entry point to ComputeManager. + */ + public static void updatesTagsOfAnImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Image resource = + manager + .images() + .getByResourceGroupWithResponse("myResourceGroup", "myImage", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "HR")) + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .withHyperVGeneration(HyperVGenerationTypes.V1) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportRequestRateByIntervalSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportRequestRateByIntervalSamples.java new file mode 100644 index 0000000000000..81e29de8f4ae0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportRequestRateByIntervalSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.IntervalInMins; +import com.azure.resourcemanager.compute.generated.models.RequestRateByIntervalInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportRequestRateByInterval. */ +public final class LogAnalyticsExportRequestRateByIntervalSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/LogAnalyticsRequestRateByInterval.json + */ + /** + * Sample code: Export logs which contain all Api requests made to Compute Resource Provider within the given time + * period broken down by intervals. + * + * @param manager Entry point to ComputeManager. + */ + public static void + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .logAnalytics() + .exportRequestRateByInterval( + "westus", + new RequestRateByIntervalInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByResourceName(true) + .withIntervalLength(IntervalInMins.FIVE_MINS), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportThrottledRequestsSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportThrottledRequestsSamples.java new file mode 100644 index 0000000000000..d78041af5f087 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/LogAnalyticsExportThrottledRequestsSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ThrottledRequestsInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportThrottledRequests. */ +public final class LogAnalyticsExportThrottledRequestsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/LogAnalyticsThrottledRequests.json + */ + /** + * Sample code: Export logs which contain all throttled Api requests made to Compute Resource Provider within the + * given time period. + * + * @param manager Entry point to ComputeManager. + */ + public static void + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .logAnalytics() + .exportThrottledRequests( + "westus", + new ThrottledRequestsInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByOperationName(true) + .withGroupByResourceName(false) + .withGroupByClientApplicationId(false) + .withGroupByUserAgent(false), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/OperationsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..535ffebb96323 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/OperationsListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void operationsListMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.operations().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void operationsListMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..70be002adb7cf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroupType; + +/** Samples for ProximityPlacementGroups CreateOrUpdate. */ +public final class ProximityPlacementGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAProximityPlacementGroup.json + */ + /** + * Sample code: Create or Update a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .define("myProximityPlacementGroup") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withProximityPlacementGroupType(ProximityPlacementGroupType.STANDARD) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsDeleteSamples.java new file mode 100644 index 0000000000000..1d783cb158f87 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups Delete. */ +public final class ProximityPlacementGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DeleteAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .deleteWithResponse("myResourceGroup", "myProximityPlacementGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..5f7109c4e21fc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups GetByResourceGroup. */ +public final class ProximityPlacementGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .proximityPlacementGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myProximityPlacementGroup", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..5ca5b6b007c53 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups ListByResourceGroup. */ +public final class ProximityPlacementGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListProximityPlacementGroupsInAResourceGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.proximityPlacementGroups().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListSamples.java new file mode 100644 index 0000000000000..7eaebfa4215fa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups List. */ +public final class ProximityPlacementGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListProximityPlacementGroupsInASubscription.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.proximityPlacementGroups().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsUpdateSamples.java new file mode 100644 index 0000000000000..bc2bf4489335b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ProximityPlacementGroupsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.ProximityPlacementGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProximityPlacementGroups Update. */ +public final class ProximityPlacementGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/PatchAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAProximityPlacementGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + ProximityPlacementGroup resource = + manager + .proximityPlacementGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myProximityPlacementGroup", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProp1", "string")).apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ResourceSkusListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ResourceSkusListSamples.java new file mode 100644 index 0000000000000..6c592fd999bb7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/ResourceSkusListSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceSkus List. */ +public final class ResourceSkusListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json + */ + /** + * Sample code: Lists all available Resource SKUs. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUs( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json + */ + /** + * Sample code: Lists all available Resource SKUs for the specified region. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUsForTheSpecifiedRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list("location eq 'westus'", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json + */ + /** + * Sample code: Lists all available Resource SKUs with Extended Location information. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableResourceSKUsWithExtendedLocationInformation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.resourceSkus().list(null, "true", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c2bebf9b68987 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsCreateOrUpdateSamples.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RestorePointCollections CreateOrUpdate. */ +public final class RestorePointCollectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateARestorePointCollectionForCrossRegionCopy.json + */ + /** + * Sample code: Create or update a restore point collection for cross region copy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARestorePointCollectionForCrossRegionCopy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .define("myRpc") + .withRegion("norwayeast") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("myTag1", "tagValue1")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateARestorePointCollection.json + */ + /** + * Sample code: Create or update a restore point collection. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .define("myRpc") + .withRegion("norwayeast") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf("myTag1", "tagValue1")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsDeleteSamples.java new file mode 100644 index 0000000000000..313993c7edec5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections Delete. */ +public final class RestorePointCollectionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().delete("rgcompute", "aaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..31ca94df89b20 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsGetByResourceGroupSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections GetByResourceGroup. */ +public final class RestorePointCollectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionWithContainedRestorePoints.json + */ + /** + * Sample code: Get a restore point collection, including the restore points contained in the restore point + * collection. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "rpcName", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollection.json + */ + /** + * Sample code: Get a restore point collection (but not the restore points contained in the restore point + * collection). + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "myRpc", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..67cae1ba21854 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections ListByResourceGroup. */ +public final class RestorePointCollectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionsInAResourceGroup.json + */ + /** + * Sample code: Gets the list of restore point collections in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void getsTheListOfRestorePointCollectionsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListSamples.java new file mode 100644 index 0000000000000..56d06d0d52286 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections List. */ +public final class RestorePointCollectionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointCollectionsInASubscription.json + */ + /** + * Sample code: Gets the list of restore point collections in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void getsTheListOfRestorePointCollectionsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePointCollections().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsUpdateSamples.java new file mode 100644 index 0000000000000..46951345e15b4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointCollectionsUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollection; +import com.azure.resourcemanager.compute.generated.models.RestorePointCollectionSourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RestorePointCollections Update. */ +public final class RestorePointCollectionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Update_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + RestorePointCollection resource = + manager + .restorePointCollections() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key8536", "aaaaaaaaaaaaaaaaaaa")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePointCollections_Update_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePointCollections_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointCollectionsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + RestorePointCollection resource = + manager + .restorePointCollections() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsCreateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsCreateSamples.java new file mode 100644 index 0000000000000..8b3a0006f8de2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsCreateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import java.util.Arrays; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CopyRestorePointBetweenRegions.json + */ + /** + * Sample code: Copy a restore point to a different region. + * + * @param manager Entry point to ComputeManager. + */ + public static void copyARestorePointToADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePoints() + .define("rpName") + .withExistingRestorePointCollection("myResourceGroup", "rpcName") + .withSourceRestorePoint( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateARestorePoint.json + */ + /** + * Sample code: Create a restore point. + * + * @param manager Entry point to ComputeManager. + */ + public static void createARestorePoint(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .restorePoints() + .define("rpName") + .withExistingRestorePointCollection("myResourceGroup", "rpcName") + .withExcludeDisks( + Arrays + .asList( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"))) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsDeleteSamples.java new file mode 100644 index 0000000000000..1b9fad542e2b5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePoints_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: RestorePoints_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().delete("rgcompute", "aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RestorePoints_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RestorePoints_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void restorePointsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", "a", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsGetSamples.java new file mode 100644 index 0000000000000..c60a1600cff5c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/RestorePointsGetSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePoint.json + */ + /** + * Sample code: Get a restore point. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARestorePoint(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().getWithResponse("myResourceGroup", "rpcName", "rpName", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetRestorePointWithInstanceView.json + */ + /** + * Sample code: Get restore point with instance view. + * + * @param manager Entry point to ComputeManager. + */ + public static void getRestorePointWithInstanceView( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.restorePoints().getWithResponse("myResourceGroup", "rpcName", "rpName", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesGetSamples.java new file mode 100644 index 0000000000000..d2b9f82153f66 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleries Get. */ +public final class SharedGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleries().getWithResponse("myLocation", "galleryUniqueName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesListSamples.java new file mode 100644 index 0000000000000..35049e39d43d0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleriesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleries List. */ +public final class SharedGalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleries.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleries().list("myLocation", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..5c1815b79ce9f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions Get. */ +public final class SharedGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImageVersions() + .getWithResponse( + "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsListSamples.java new file mode 100644 index 0000000000000..74de26ddbd670 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImageVersionsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions List. */ +public final class SharedGalleryImageVersionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImageVersions.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImageVersions() + .list("myLocation", "galleryUniqueName", "myGalleryImageName", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesGetSamples.java new file mode 100644 index 0000000000000..a96979afbfccf --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages Get. */ +public final class SharedGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sharedGalleryImages() + .getWithResponse("myLocation", "galleryUniqueName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesListSamples.java new file mode 100644 index 0000000000000..8fbd7494bf574 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SharedGalleryImagesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages List. */ +public final class SharedGalleryImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImages.json + */ + /** + * Sample code: Get a gallery. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAGallery(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sharedGalleryImages().list("myLocation", "galleryUniqueName", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e31387e9a86aa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsCreateOrUpdateSamples.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.CreationData; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOption; + +/** Samples for Snapshots CreateOrUpdate. */ +public final class SnapshotsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotFromAnExistingSnapshotInDifferentRegion.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription in a different + * region. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot2") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY_START) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from the same subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot1") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from a different subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .define("mySnapshot1") + .withRegion("West US") + .withExistingResourceGroup("myResourceGroup") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsDeleteSamples.java new file mode 100644 index 0000000000000..c28e2e2f06e3e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots Delete. */ +public final class SnapshotsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/DeleteASnapshot.json + */ + /** + * Sample code: Delete a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().delete("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4bb6ba94fcd14 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots GetByResourceGroup. */ +public final class SnapshotsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/GetInformationAboutASnapshot.json + */ + /** + * Sample code: Get information about a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInformationAboutASnapshot( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGrantAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGrantAccessSamples.java new file mode 100644 index 0000000000000..e9c6b995a3b86 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsGrantAccessSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.AccessLevel; +import com.azure.resourcemanager.compute.generated.models.GrantAccessData; + +/** Samples for Snapshots GrantAccess. */ +public final class SnapshotsGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/BeginGetAccessSnapshot.json + */ + /** + * Sample code: Get a sas on a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void getASasOnASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .snapshots() + .grantAccess( + "myResourceGroup", + "mySnapshot", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..12f04db525bd0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots ListByResourceGroup. */ +public final class SnapshotsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListSnapshotsInAResourceGroup.json + */ + /** + * Sample code: List all snapshots in a resource group. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllSnapshotsInAResourceGroup( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListSamples.java new file mode 100644 index 0000000000000..17caaad196332 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots List. */ +public final class SnapshotsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/ListSnapshotsInASubscription.json + */ + /** + * Sample code: List all snapshots in a subscription. + * + * @param manager Entry point to ComputeManager. + */ + public static void listAllSnapshotsInASubscription( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsRevokeAccessSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsRevokeAccessSamples.java new file mode 100644 index 0000000000000..fa369a53ec152 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsRevokeAccessSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots RevokeAccess. */ +public final class SnapshotsRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/EndGetAccessSnapshot.json + */ + /** + * Sample code: Revoke access to a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void revokeAccessToASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.snapshots().revokeAccess("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsUpdateSamples.java new file mode 100644 index 0000000000000..a01dcf35b6553 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SnapshotsUpdateSamples.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.Snapshot; +import com.azure.resourcemanager.compute.generated.models.SupportedCapabilities; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Snapshots Update. */ +public final class SnapshotsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateASnapshotWithAcceleratedNetwork.json + */ + /** + * Sample code: Update a snapshot with accelerated networking. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASnapshotWithAcceleratedNetworking( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Snapshot resource = + manager + .snapshots() + .getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "UpdateSnapshots")) + .withDiskSizeGB(20) + .withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-08-01/examples/UpdateASnapshot.json + */ + /** + * Sample code: Update a snapshot. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateASnapshot(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + Snapshot resource = + manager + .snapshots() + .getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("department", "Development", "project", "UpdateSnapshots")) + .withDiskSizeGB(20) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysCreateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysCreateSamples.java new file mode 100644 index 0000000000000..fc096e7ed8961 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +/** Samples for SshPublicKeys Create. */ +public final class SshPublicKeysCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAnSshPublicKey.json + */ + /** + * Sample code: Create a new SSH public key resource. + * + * @param manager Entry point to ComputeManager. + */ + public static void createANewSSHPublicKeyResource( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .sshPublicKeys() + .define("mySshPublicKeyName") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPublicKey("{ssh-rsa public key}") + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysDeleteSamples.java new file mode 100644 index 0000000000000..2ca733f0d9885 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysDeleteSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys Delete. */ +public final class SshPublicKeysDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().deleteWithResponse("rgcompute", "aaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().deleteWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGenerateKeyPairSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGenerateKeyPairSamples.java new file mode 100644 index 0000000000000..5e64c9c007a63 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGenerateKeyPairSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GenerateKeyPair. */ +public final class SshPublicKeysGenerateKeyPairSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GenerateSshKeyPair.json + */ + /** + * Sample code: Generate an SSH key pair. + * + * @param manager Entry point to ComputeManager. + */ + public static void generateAnSSHKeyPair(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().generateKeyPairWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..7e7d1aab244eb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GetByResourceGroup. */ +public final class SshPublicKeysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetAnSshPublicKey.json + */ + /** + * Sample code: Get an ssh public key. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAnSshPublicKey(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().getByResourceGroupWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..6bdf1cacf9028 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys ListByResourceGroup. */ +public final class SshPublicKeysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListByResourceGroup_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListByResourceGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListByResourceGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().listByResourceGroup("rgcompute", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListSamples.java new file mode 100644 index 0000000000000..085206621f45d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys List. */ +public final class SshPublicKeysListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListBySubscription_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListBySubscription_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListBySubscriptionMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.sshPublicKeys().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysUpdateSamples.java new file mode 100644 index 0000000000000..c727f34373e5c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/SshPublicKeysUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.SshPublicKeyResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SshPublicKeys Update. */ +public final class SshPublicKeysUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Update_MaximumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + SshPublicKeyResource resource = + manager + .sshPublicKeys() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaa", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key2854", "a")).withPublicKey("{ssh-rsa public key}").apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SshPublicKeys_Update_MinimumSet_Gen.json + */ + /** + * Sample code: SshPublicKeys_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void sshPublicKeysUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + SshPublicKeyResource resource = + manager.sshPublicKeys().getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaa", Context.NONE).getValue(); + resource.update().apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/UsageListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/UsageListSamples.java new file mode 100644 index 0000000000000..c0f0984e57c0c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/UsageListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Usage List. */ +public final class UsageListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Usage_List_MinimumSet_Gen.json + */ + /** + * Sample code: Usage_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void usageListMinimumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.usages().list("_--", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/Usage_List_MaximumSet_Gen.json + */ + /** + * Sample code: Usage_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void usageListMaximumSetGen(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.usages().list("4_.", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesGetSamples.java new file mode 100644 index 0000000000000..269e52afe8581 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesGetSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages Get. */ +public final class VirtualMachineExtensionImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .getWithResponse( + "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .getWithResponse("aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", "aaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListTypesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListTypesSamples.java new file mode 100644 index 0000000000000..47aa51a103790 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListTypesSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages ListTypes. */ +public final class VirtualMachineExtensionImagesListTypesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListTypes_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListTypesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listTypesWithResponse("aaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListTypes_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListTypesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineExtensionImages().listTypesWithResponse("aaaa", "aa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListVersionsSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListVersionsSamples.java new file mode 100644 index 0000000000000..04e243b193834 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionImagesListVersionsSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensionImages ListVersions. */ +public final class VirtualMachineExtensionImagesListVersionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListVersions_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListVersionsMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listVersionsWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaa", + 22, + "a", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensionImages_ListVersions_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionImagesListVersionsMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensionImages() + .listVersionsWithResponse( + "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", null, null, null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fc5c22f1a6cc7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsCreateOrUpdateSamples.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.InstanceViewStatus; +import com.azure.resourcemanager.compute.generated.models.StatusLevelTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtensionInstanceView; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineExtensions CreateOrUpdate. */ +public final class VirtualMachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .define("aaaaaaaaaaaaaaaaaaaaaaaa") + .withRegion("westus") + .withExistingVirtualMachine("rgcompute", "aaaa") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineExtensions() + .define("aaaaaaaaaaaaa") + .withRegion("westus") + .withExistingVirtualMachine("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa") + .withTags(mapOf("key9183", "aa")) + .withForceUpdateTag("a") + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withInstanceView( + new VirtualMachineExtensionInstanceView() + .withName("aaaaaaaaaaaaaaaaa") + .withType("aaaaaaaaa") + .withTypeHandlerVersion("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSubstatuses( + Arrays + .asList( + new InstanceViewStatus() + .withCode("aaaaaaaaaaaaaaaaaaaaaaa") + .withLevel(StatusLevelTypes.INFO) + .withDisplayStatus("aaaaaa") + .withMessage("a") + .withTime(OffsetDateTime.parse("2021-11-30T12:58:26.522Z")))) + .withStatuses( + Arrays + .asList( + new InstanceViewStatus() + .withCode("aaaaaaaaaaaaaaaaaaaaaaa") + .withLevel(StatusLevelTypes.INFO) + .withDisplayStatus("aaaaaa") + .withMessage("a") + .withTime(OffsetDateTime.parse("2021-11-30T12:58:26.522Z"))))) + .withSuppressFailures(true) + .create(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsDeleteSamples.java new file mode 100644 index 0000000000000..34da286fd93ce --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsDeleteSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions Delete. */ +public final class VirtualMachineExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .delete("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineExtensions().delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsGetSamples.java new file mode 100644 index 0000000000000..46a4edd47f590 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsGetSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions Get. */ +public final class VirtualMachineExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .getWithResponse("rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", "aaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsListSamples.java new file mode 100644 index 0000000000000..d4878c0947d5a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsListSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineExtensions List. */ +public final class VirtualMachineExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .listWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineExtensions_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineExtensions_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineExtensionsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineExtensions() + .listWithResponse("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsUpdateSamples.java new file mode 100644 index 0000000000000..8936787cce05d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineExtensionsUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineExtension; +import java.io.IOException; + +/** Samples for VirtualMachineExtensions Update. */ +public final class VirtualMachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMExtension.json + */ + /** + * Sample code: Update VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVMExtension(com.azure.resourcemanager.compute.generated.ComputeManager manager) + throws IOException { + VirtualMachineExtension resource = + manager + .virtualMachineExtensions() + .getWithResponse("myResourceGroup", "myVM", "myVMExtension", null, Context.NONE) + .getValue(); + resource + .update() + .withPublisher("extPublisher") + .withType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"secretUrl\":\"https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e\",\"sourceVault\":{\"id\":\"/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName\"}}", + Object.class, + SerializerEncoding.JSON)) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneGetSamples.java new file mode 100644 index 0000000000000..82f0a8449c671 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneGetSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone Get. */ +public final class VirtualMachineImagesEdgeZoneGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .getWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .getWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaa", + "aa", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListOffersSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListOffersSamples.java new file mode 100644 index 0000000000000..d4aad465edec6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListOffersSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListOffers. */ +public final class VirtualMachineImagesEdgeZoneListOffersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListOffersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listOffersWithResponse("aaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListOffersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listOffersWithResponse( + "aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListPublishersSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListPublishersSamples.java new file mode 100644 index 0000000000000..42eb70a88d400 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListPublishersSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListPublishers. */ +public final class VirtualMachineImagesEdgeZoneListPublishersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListPublishersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listPublishersWithResponse("aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListPublishersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listPublishersWithResponse("aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSamples.java new file mode 100644 index 0000000000000..10c0efc5f4261 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone List. */ +public final class VirtualMachineImagesEdgeZoneListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listWithResponse( + "aaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaa", + 12, + "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listWithResponse( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaa", + "aaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSkusSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSkusSamples.java new file mode 100644 index 0000000000000..1be654e3533fd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesEdgeZoneListSkusSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImagesEdgeZone ListSkus. */ +public final class VirtualMachineImagesEdgeZoneListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listSkusWithResponse("aaaaaaaaaaaa", "aaaaa", "aaaaaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesEdgeZoneListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImagesEdgeZones() + .listSkusWithResponse( + "aaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesGetSamples.java new file mode 100644 index 0000000000000..b143988c33a73 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesGetSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages Get. */ +public final class VirtualMachineImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .getWithResponse( + "aaaaaaaaaaaa", "aaaaaaaaaaa", "aa", "aaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .getWithResponse( + "aaaaaa", + "aaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaa", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListOffersSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListOffersSamples.java new file mode 100644 index 0000000000000..d7b0b2f1eb0eb --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListOffersSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListOffers. */ +public final class VirtualMachineImagesListOffersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListOffers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListOffers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListOffersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listOffersWithResponse("aaaaaaa", "aaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListOffers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListOffers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListOffersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listOffersWithResponse("aaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListPublishersSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListPublishersSamples.java new file mode 100644 index 0000000000000..611369e0d9736 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListPublishersSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListPublishers. */ +public final class VirtualMachineImagesListPublishersSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListPublishers_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListPublishers_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListPublishersMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listPublishersWithResponse("aaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListPublishers_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListPublishers_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListPublishersMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listPublishersWithResponse("aaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSamples.java new file mode 100644 index 0000000000000..11a8ebd9b94a0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages List. */ +public final class VirtualMachineImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listWithResponse("aaaaaaa", "aaaaaaaaaaa", "aaaaaaaaaa", "aaaaaa", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listWithResponse( + "aaaaaaaaaaaaaaa", + "aaaaaa", + "aaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaa", + 18, + "aa", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSkusSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSkusSamples.java new file mode 100644 index 0000000000000..afd450a0d9e24 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineImagesListSkusSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineImages ListSkus. */ +public final class VirtualMachineImagesListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineImages().listSkusWithResponse("aaaa", "aaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineImages_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineImages_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineImagesListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineImages() + .listSkusWithResponse("aaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d297674acff01 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineRunCommands CreateOrUpdate. */ +public final class VirtualMachineRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/CreateOrUpdateRunCommand.json + */ + /** + * Sample code: Create or update a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineRunCommands() + .define("myRunCommand") + .withRegion("West US") + .withExistingVirtualMachine("myResourceGroup", "myVM") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsDeleteSamples.java new file mode 100644 index 0000000000000..b3606133e5890 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Delete. */ +public final class VirtualMachineRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/DeleteRunCommand.json + */ + /** + * Sample code: Delete a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().delete("myResourceGroup", "myVM", "myRunCommand", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java new file mode 100644 index 0000000000000..d0b719ba6778b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands GetByVirtualMachine. */ +public final class VirtualMachineRunCommandsGetByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/GetRunCommand.json + */ + /** + * Sample code: Get a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void getARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineRunCommands() + .getByVirtualMachineWithResponse("myResourceGroup", "myVM", "myRunCommand", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetSamples.java new file mode 100644 index 0000000000000..427888e599957 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Get. */ +public final class VirtualMachineRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommandGet.json + */ + /** + * Sample code: VirtualMachineRunCommandGet. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommandGet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().getWithResponse("SoutheastAsia", "RunPowerShellScript", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java new file mode 100644 index 0000000000000..ff49cb3ea2279 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands ListByVirtualMachine. */ +public final class VirtualMachineRunCommandsListByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/ListRunCommandsInVM.json + */ + /** + * Sample code: List run commands in a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRunCommandsInAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().listByVirtualMachine("myResourceGroup", "myVM", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListSamples.java new file mode 100644 index 0000000000000..21ee1d2498e38 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands List. */ +public final class VirtualMachineRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommandList.json + */ + /** + * Sample code: VirtualMachineRunCommandList. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommandList( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineRunCommands().list("SoutheastAsia", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsUpdateSamples.java new file mode 100644 index 0000000000000..5976b0a1d7205 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineRunCommandsUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommand; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; + +/** Samples for VirtualMachineRunCommands Update. */ +public final class VirtualMachineRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/UpdateRunCommand.json + */ + /** + * Sample code: Update a run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateARunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineRunCommand resource = + manager + .virtualMachineRunCommands() + .getByVirtualMachineWithResponse("myResourceGroup", "myVM", "myRunCommand", null, Context.NONE) + .getValue(); + resource + .update() + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4131e89201634 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsCreateOrUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetExtensions CreateOrUpdate. */ +public final class VirtualMachineScaleSetExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSetExtensions() + .define("aaaaaaaaaaaaaaaaaaaaa") + .withExistingVirtualMachineScaleSet("rgcompute", "aaaaaaa") + .withName("{extension-name}") + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .define("aaaaaaaaaaa") + .withExistingVirtualMachineScaleSet("rgcompute", "aaaaaaaaaaa") + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsDeleteSamples.java new file mode 100644 index 0000000000000..6af8c4f8582fe --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsDeleteSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions Delete. */ +public final class VirtualMachineScaleSetExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Delete_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsDeleteMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .delete("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Delete_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsDeleteMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().delete("rgcompute", "aaaa", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsGetSamples.java new file mode 100644 index 0000000000000..7aa329edc3785 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsGetSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions Get. */ +public final class VirtualMachineScaleSetExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Get_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsGetMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "a", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Get_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsGetMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaa", "aaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsListSamples.java new file mode 100644 index 0000000000000..c615e53a5e24b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetExtensions List. */ +public final class VirtualMachineScaleSetExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().list("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetExtensions().list("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsUpdateSamples.java new file mode 100644 index 0000000000000..53c50e55b4423 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetExtensionsUpdateSamples.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtension; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetExtensions Update. */ +public final class VirtualMachineScaleSetExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSetExtension resource = + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetExtensions_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetExtensionsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineScaleSetExtension resource = + manager + .virtualMachineScaleSetExtensions() + .getWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", "aa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesCancelSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesCancelSamples.java new file mode 100644 index 0000000000000..8ce1ed5ec7fe4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesCancelSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades Cancel. */ +public final class VirtualMachineScaleSetRollingUpgradesCancelSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_Cancel_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesCancelMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().cancel("rgcompute", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_Cancel_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesCancelMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().cancel("rgcompute", "aaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesGetLatestSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesGetLatestSamples.java new file mode 100644 index 0000000000000..d297e7c30ef64 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesGetLatestSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades GetLatest. */ +public final class VirtualMachineScaleSetRollingUpgradesGetLatestSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_GetLatest_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesGetLatestMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .getLatestWithResponse("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_GetLatest_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesGetLatestMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .getLatestWithResponse("rgcompute", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java new file mode 100644 index 0000000000000..04080a91694c8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades StartExtensionUpgrade. */ +public final class VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VMScaleSetExtensionRollingUpgrade.json + */ + /** + * Sample code: Start an extension rolling upgrade. + * + * @param manager Entry point to ComputeManager. + */ + public static void startAnExtensionRollingUpgrade( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetRollingUpgrades() + .startExtensionUpgrade("myResourceGroup", "{vmss-name}", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartOSUpgradeSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartOSUpgradeSamples.java new file mode 100644 index 0000000000000..fc9be128b57b1 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetRollingUpgradesStartOSUpgradeSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades StartOSUpgrade. */ +public final class VirtualMachineScaleSetRollingUpgradesStartOSUpgradeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesStartOSUpgradeMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().startOSUpgrade("rgcompute", "aaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetRollingUpgrades_StartOSUpgrade_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetRollingUpgradesStartOSUpgradeMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetRollingUpgrades().startOSUpgrade("rgcompute", "aaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b31e2872f98aa --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void createVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSetVMExtensions() + .define("myVMExtension") + .withExistingVirtualMachine("myResourceGroup", "myvmScaleSet", "0") + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java new file mode 100644 index 0000000000000..7eb941c91fce9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Delete. */ +public final class VirtualMachineScaleSetVMExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/DeleteVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .delete("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java new file mode 100644 index 0000000000000..90d0b611e8544 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Get. */ +public final class VirtualMachineScaleSetVMExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsListSamples.java new file mode 100644 index 0000000000000..9e12e725cc974 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions List. */ +public final class VirtualMachineScaleSetVMExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: List extensions in Vmss instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void listExtensionsInVmssInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMExtensions() + .listWithResponse("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java new file mode 100644 index 0000000000000..1d3e944d7478d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMExtension; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions Update. */ +public final class VirtualMachineScaleSetVMExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM extension. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVirtualMachineScaleSetVMExtension( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSetVMExtension resource = + manager + .virtualMachineScaleSetVMExtensions() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", null, Context.NONE) + .getValue(); + resource + .update() + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .apply(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..95d7f614a70b8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.generated.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMRunCommands CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/CreateOrUpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void createVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .createOrUpdate( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandInner() + .withLocation("West US") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java new file mode 100644 index 0000000000000..c5e31f7c53b6b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Delete. */ +public final class VirtualMachineScaleSetVMRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/DeleteVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void deleteVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .delete("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java new file mode 100644 index 0000000000000..e909c361a59c7 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Get. */ +public final class VirtualMachineScaleSetVMRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/GetVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM run commands. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineScaleSetVMRunCommands( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java new file mode 100644 index 0000000000000..678b6dcf80a1a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands List. */ +public final class VirtualMachineScaleSetVMRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/ListVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: List run commands in Vmss instance. + * + * @param manager Entry point to ComputeManager. + */ + public static void listRunCommandsInVmssInstance( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMRunCommands().list("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java new file mode 100644 index 0000000000000..51219a4fdcff5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandScriptSource; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineRunCommandUpdate; + +/** Samples for VirtualMachineScaleSetVMRunCommands Update. */ +public final class VirtualMachineScaleSetVMRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/UpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM run command. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateVirtualMachineScaleSetVMRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMRunCommands() + .update( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandUpdate() + .withSource( + new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeallocateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeallocateSamples.java new file mode 100644 index 0000000000000..45355527399c6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeallocateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Deallocate. */ +public final class VirtualMachineScaleSetVMsDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeleteSamples.java new file mode 100644 index 0000000000000..a0ddbf5429a91 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Delete. */ +public final class VirtualMachineScaleSetVMsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachineScaleSetVM.json + */ + /** + * Sample code: Force Delete a virtual machine from a VM scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVirtualMachineFromAVMScaleSet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().delete("myResourceGroup", "myvmScaleSet", "0", true, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java new file mode 100644 index 0000000000000..10c7d485a8c62 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs GetInstanceView. */ +public final class VirtualMachineScaleSetVMsGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine from a VM scale set placed on a dedicated host group through + * automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .getInstanceViewWithResponse("myResourceGroup", "myVirtualMachineScaleSet", "0", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetSamples.java new file mode 100644 index 0000000000000..3b582b125706f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsGetSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Get. */ +public final class VirtualMachineScaleSetVMsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMWithVMSizeProperties.json + */ + /** + * Sample code: Get VM scale set VM with VMSizeProperties. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVMScaleSetVMWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().getWithResponse("myResourceGroup", "{vmss-name}", "0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetVMWithUserData.json + */ + /** + * Sample code: Get VM scale set VM with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVMScaleSetVMWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().getWithResponse("myResourceGroup", "{vmss-name}", "0", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsListSamples.java new file mode 100644 index 0000000000000..4f232e7fde7e6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsListSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs List. */ +public final class VirtualMachineScaleSetVMsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .list("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .list( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaa", + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPerformMaintenanceSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPerformMaintenanceSamples.java new file mode 100644 index 0000000000000..a8ce1549e5774 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPerformMaintenanceSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs PerformMaintenance. */ +public final class VirtualMachineScaleSetVMsPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().performMaintenance("rgcompute", "aaaaaaaaaa", "aaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .performMaintenance("rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPowerOffSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPowerOffSamples.java new file mode 100644 index 0000000000000..e0a7c6f4dc42e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsPowerOffSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs PowerOff. */ +public final class VirtualMachineScaleSetVMsPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().powerOff("rgcompute", "aaaaaa", "aaaaaaaaa", true, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .powerOff("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRedeploySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRedeploySamples.java new file mode 100644 index 0000000000000..4de54005295b9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRedeploySamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Redeploy. */ +public final class VirtualMachineScaleSetVMsRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .redeploy("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .redeploy("rgcompute", "aaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageAllSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageAllSamples.java new file mode 100644 index 0000000000000..7e8882cb15842 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageAllSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs ReimageAll. */ +public final class VirtualMachineScaleSetVMsReimageAllSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_ReimageAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_ReimageAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageSamples.java new file mode 100644 index 0000000000000..c4c5966640f67 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsReimageSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMReimageParameters; + +/** Samples for VirtualMachineScaleSetVMs Reimage. */ +public final class VirtualMachineScaleSetVMsReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Reimage_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .reimage( + "rgcompute", + "aaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMReimageParameters().withTempDisk(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Reimage_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsReimageMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().reimage("rgcompute", "aaaaaaa", "aaaaaaaaaaaaa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRestartSamples.java new file mode 100644 index 0000000000000..008e42b31cf77 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRestartSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Restart. */ +public final class VirtualMachineScaleSetVMsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().restart("rgcompute", "aaaaaaaaaaaa", "aaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().restart("rgcompute", "aa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java new file mode 100644 index 0000000000000..88d9b029310cc --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs RetrieveBootDiagnosticsData. */ +public final class VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "myvmScaleSet", "0", 60, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRunCommandSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRunCommandSamples.java new file mode 100644 index 0000000000000..242c073ed82f3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsRunCommandSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMs RunCommand. */ +public final class VirtualMachineScaleSetVMsRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VMScaleSetRunCommand.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_RunCommand. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsRunCommand( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .runCommand( + "myResourceGroup", + "myVirtualMachineScaleSet", + "0", + new RunCommandInput() + .withCommandId("RunPowerShellScript") + .withScript(Arrays.asList("Write-Host Hello World!")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java new file mode 100644 index 0000000000000..3ce6ec304ead0 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs SimulateEviction. */ +public final class VirtualMachineScaleSetVMsSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SimulateEvictionOfVmssVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void simulateEvictionAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .simulateEvictionWithResponse("ResourceGroup", "VmScaleSetName", "InstanceId", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsStartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsStartSamples.java new file mode 100644 index 0000000000000..2d6542cca212c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsStartSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Start. */ +public final class VirtualMachineScaleSetVMsStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .start("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSetVMs().start("rgcompute", "aaaaaaaaaaaaaa", "aaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsUpdateSamples.java new file mode 100644 index 0000000000000..bfafdf698fdb6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetVMsUpdateSamples.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetVMInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AdditionalUnattendContent; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.ComponentNames; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDetachOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSettings; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.IpVersions; +import com.azure.resourcemanager.compute.generated.models.KeyVaultKeyReference; +import com.azure.resourcemanager.compute.generated.models.KeyVaultSecretReference; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PassNames; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ProtocolTypes; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSku; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.compute.generated.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SettingNames; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressDnsSettingsConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMNetworkProfileConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProtectionPolicy; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import com.azure.resourcemanager.compute.generated.models.WinRMConfiguration; +import com.azure.resourcemanager.compute.generated.models.WinRMListener; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineScaleSetVMs Update. */ +public final class VirtualMachineScaleSetVMsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .update( + "rgcompute", + "aaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInner().withLocation("westus"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSetVMs_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetVMsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSetVMs() + .update( + "rgcompute", + "aaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInner() + .withLocation("westus") + .withTags(mapOf()) + .withPlan( + new Plan() + .withName("aaaaaaaaaa") + .withPublisher("aaaaaaaaaaaaaaaaaaaaaa") + .withProduct("aaaaaaaaaaaaaaaaaaaa") + .withPromotionCode("aaaaaaaaaaaaaaaaaaaa")) + .withHardwareProfile( + new HardwareProfile() + .withVmSize(VirtualMachineSizeTypes.BASIC_A0) + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(9).withVCpusPerCore(12))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId("a") + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2012-R2-Datacenter") + .withVersion("4.127.20180315") + .withSharedGalleryImageId("aaaaaaaaaaaaaaaaaaaa")) + .withOsDisk( + new OSDisk() + .withOsType(OperatingSystemTypes.WINDOWS) + .withEncryptionSettings( + new DiskEncryptionSettings() + .withDiskEncryptionKey( + new KeyVaultSecretReference() + .withSecretUrl("aaaaaaaa") + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withKeyEncryptionKey( + new KeyVaultKeyReference() + .withKeyUrl("aaaaaaaaaaaaaa") + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withEnabled(true)) + .withName("vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc") + .withVhd( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(127) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(1) + .withName("vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d") + .withVhd( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd")) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(128) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withToBeDetached(true) + .withDetachOption(DiskDetachOptionTypes.FORCE_DETACH) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)))) + .withAdditionalCapabilities( + new AdditionalCapabilities().withUltraSsdEnabled(true).withHibernationEnabled(true)) + .withOsProfile( + new OSProfile() + .withComputerName("test000000") + .withAdminUsername("Foo12") + .withAdminPassword("aaaaaaaaaaaaaaaa") + .withCustomData("aaaa") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("aaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withAdditionalUnattendContent( + Arrays + .asList( + new AdditionalUnattendContent() + .withPassName(PassNames.OOBE_SYSTEM) + .withComponentName(ComponentNames.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("aaaaaaaaaaaaaaaaaaaa"))) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)) + .withWinRM( + new WinRMConfiguration() + .withListeners( + Arrays + .asList( + new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("aaaaaaaaaaaaaaaaaaaaaa"))))) + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList(new SshPublicKey().withPath("aaa").withKeyData("aaaaaa")))) + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT))) + .withSecrets(Arrays.asList()) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceConfiguration() + .withName("aaaaaaaaaaa") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withEnableIpForwarding(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withDnsSettings( + new VirtualMachineNetworkInterfaceDnsSettingsConfiguration() + .withDnsServers(Arrays.asList("aaaaaa"))) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceIpConfiguration() + .withName("aa") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachinePublicIpAddressConfiguration() + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL)) + .withIdleTimeoutInMinutes(2) + .withDeleteOption(DeleteOptions.DELETE) + .withDnsSettings( + new VirtualMachinePublicIpAddressDnsSettingsConfiguration() + .withDomainNameLabel( + "aaaaaaaaaaaaaaaaaaaaaaaaa")) + .withIpTags( + Arrays + .asList( + new VirtualMachineIpTag() + .withIpTagType( + "aaaaaaaaaaaaaaaaaaaaaaaaa") + .withTag("aaaaaaaaaaaaaaaaaaaa"))) + .withPublicIpPrefix( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPublicIpAddressVersion(IpVersions.IPV4) + .withPublicIpAllocationMethod( + PublicIpAllocationMethod.DYNAMIC)) + .withPrivateIpAddressVersion(IpVersions.IPV4) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withDscpConfiguration( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withNetworkProfileConfiguration( + new VirtualMachineScaleSetVMNetworkProfileConfiguration() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withId("aaaaaaaa") + .withName("vmsstestnetconfig5415") + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withDnsSettings( + new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList())) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withId("aaaaaaaaa") + .withName("vmsstestnetconfig9693") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("aaaaaaaaaaaaaaaaaa") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL)) + .withIdleTimeoutInMinutes(18) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("aaaaaaaaaaaaaaaaaa")) + .withIpTags( + Arrays + .asList( + new VirtualMachineScaleSetIpTag() + .withIpTagType("aaaaaaa") + .withTag( + "aaaaaaaaaaaaaaaaaaaaaaaaaaa"))) + .withPublicIpPrefix( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics().withEnabled(true).withStorageUri("aaaaaaaaaaaaa"))) + .withAvailabilitySet( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withLicenseType("aaaaaaaaaa") + .withProtectionPolicy( + new VirtualMachineScaleSetVMProtectionPolicy() + .withProtectFromScaleIn(true) + .withProtectFromScaleSetActions(true)) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ=="), + Context.NONE); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsConvertToSinglePlacementGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsConvertToSinglePlacementGroupSamples.java new file mode 100644 index 0000000000000..08a7f8c252d1a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsConvertToSinglePlacementGroupSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VMScaleSetConvertToSinglePlacementGroupInput; + +/** Samples for VirtualMachineScaleSets ConvertToSinglePlacementGroup. */ +public final class VirtualMachineScaleSetsConvertToSinglePlacementGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsConvertToSinglePlacementGroupMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .convertToSinglePlacementGroupWithResponse( + "rgcompute", "aaaaaaaaaaaaa", new VMScaleSetConvertToSinglePlacementGroupInput(), Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ConvertToSinglePlacementGroup_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsConvertToSinglePlacementGroupMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .convertToSinglePlacementGroupWithResponse( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VMScaleSetConvertToSinglePlacementGroupInput() + .withActivePlacementGroupId("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ed2de0e239c7a --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java @@ -0,0 +1,2316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.UpgradeMode; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetScaleInRules; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMProfile; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets CreateOrUpdate. */ +public final class VirtualMachineScaleSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ + /** + * Sample code: Create a scale set with empty data disks on each vm. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEmptyDataDisksOnEachVm( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D2_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithUserData.json + */ + /** + * Sample code: Create a scale set with userData. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==")) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ + /** + * Sample code: Create a scale set with Fpga Network Interfaces. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithFpgaNetworkInterfaces( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true), + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{fpgaNic-Name}") + .withPrimary(false) + .withEnableAcceleratedNetworking(false) + .withEnableFpga(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{fpgaNic-Name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}")) + .withPrimary(true) + .withPrivateIpAddressVersion(IpVersion.IPV4))) + .withEnableIpForwarding(false))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromACustomImage.json + */ + /** + * Sample code: Create a scale set from a custom image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromACustomImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEphemeralOsDisksUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithScaleInPolicy.json + */ + /** + * Sample code: Create a scale set with scaleInPolicy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithScaleInPolicy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .withScaleInPolicy( + new ScaleInPolicy() + .withRules(Arrays.asList(VirtualMachineScaleSetScaleInRules.OLDEST_VM)) + .withForceDeletion(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithEncryptionAtHost.json + */ + /** + * Sample code: Create a scale set with Host Encryption using encryptionAtHost property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithProtectedSettingsFromKeyVault.json + */ + /** + * Sample code: Create a VMSS with an extension with protectedSettingsFromKeyVault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMSSWithAnExtensionWithProtectedSettingsFromKeyVault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettingsFromKeyVault( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"secretUrl\":\"https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e\",\"sourceVault\":{\"id\":\"/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName\"}}", + Object.class, + SerializerEncoding.JSON)))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAnAzureLoadBalancer.json + */ + /** + * Sample code: Create a scale set with an azure load balancer. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAnAzureLoadBalancer( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("{vmss-name}") + .withPublicIpAddressVersion(IpVersion.IPV4)) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with managed boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithManagedBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a scale set with a marketplace image plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAMarketplaceImagePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithDiffOsDisk.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithEphemeralOsDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithVMsInDifferentZones.json + */ + /** + * Sample code: Create a scale set with virtual machines in different zones. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithVirtualMachinesInDifferentZones( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("centralus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_A1_v2").withTier("Standard").withCapacity(2L)) + .withZones(Arrays.asList("1", "3")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithCapacityReservation.json + */ + /** + * Sample code: Create or update a scale set with capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAScaleSetWithCapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}")))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSecurityTypeConfidentialVM.json + */ + /** + * Sample code: Create a scale set with SecurityType as ConfidentialVM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSecurityTypeAsConfidentialVM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DC2as_v5").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType( + SecurityEncryptionTypes.VMGUEST_STATE_ONLY))))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSshAuthentication.json + */ + /** + * Sample code: Create a scale set with ssh authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSshAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAnAzureApplicationGateway.json + */ + /** + * Sample code: Create a scale set with an azure application gateway. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAnAzureApplicationGateway( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image scale set from an unmanaged generalized os image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a scale set with extension time budget. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithExtensionTimeBudget( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)))) + .withExtensionsTimeBudget("PT1H20M"))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithApplicationProfile.json + */ + /** + * Sample code: Create a scale set with Application Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithApplicationProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScalesetWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a scale set with DiskEncryptionSet resource in os disk and data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithPremiumStorage.json + */ + /** + * Sample code: Create a scale set with premium storage. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithPremiumStorage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAScaleSetWithVMSizeProperties.json + */ + /** + * Sample code: Create a scale set with vm size properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithVmSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==") + .withHardwareProfile( + new VirtualMachineScaleSetHardwareProfile() + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(1).withVCpusPerCore(1)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ + /** + * Sample code: Create a scale set with terminate scheduled events enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithTerminateScheduledEventsEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT5M").withEnable(true)))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithExtensionsSuppressFailuresEnabled.json + */ + /** + * Sample code: Create a VMSS with an extension that has suppressFailures enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMSSWithAnExtensionThatHasSuppressFailuresEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ + /** + * Sample code: Create a platform-image scale set with unmanaged os disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAPlatformImageScaleSetWithUnmanagedOsDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withVhdContainers( + Arrays + .asList( + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithUefiSettings.json + */ + /** + * Sample code: Create a scale set with Uefi Settings of secureBoot and vTPM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D2s_v3").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithPasswordAuthentication.json + */ + /** + * Sample code: Create a scale set with password authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithPasswordAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithAutomaticRepairs.json + */ + /** + * Sample code: Create a scale set with automatic repairs enabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithAutomaticRepairsEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withAutomaticRepairsPolicy(new AutomaticRepairsPolicy().withEnabled(true).withGracePeriod("PT10M")) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithSpotRestorePolicy.json + */ + /** + * Sample code: Create a scale set with spot restore policy. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithSpotRestorePolicy( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_A8m_v2").withTier("Standard").withCapacity(2L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withPriority(VirtualMachinePriorityTypes.SPOT) + .withEvictionPolicy(VirtualMachineEvictionPolicyTypes.DEALLOCATE) + .withBillingProfile(new BillingProfile().withMaxPrice(-1.0))) + .withOverprovision(true) + .withSpotRestorePolicy(new SpotRestorePolicy().withEnabled(true).withRestoreTimeout("PT1H")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a scale set from a generalized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromAGeneralizedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetWithBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetWithBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net")))) + .withOverprovision(true) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAScaleSetFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a scale set from a specialized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAScaleSetFromASpecializedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .define("{vmss-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeallocateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeallocateSamples.java new file mode 100644 index 0000000000000..16360f8b4fb6e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeallocateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Deallocate. */ +public final class VirtualMachineScaleSetsDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().deallocate("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deallocate( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteInstancesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteInstancesSamples.java new file mode 100644 index 0000000000000..e038bce000a5d --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteInstancesSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets DeleteInstances. */ +public final class VirtualMachineScaleSetsDeleteInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_DeleteInstances_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeleteInstancesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deleteInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + true, + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_DeleteInstances_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsDeleteInstancesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .deleteInstances( + "rgcompute", + "aaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + null, + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteSamples.java new file mode 100644 index 0000000000000..75f29bb08b4de --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets Delete. */ +public final class VirtualMachineScaleSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachineScaleSets.json + */ + /** + * Sample code: Force Delete a VM scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVMScaleSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().delete("myResourceGroup", "myvmScaleSet", true, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkSamples.java new file mode 100644 index 0000000000000..4bc3634f649a8 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ForceRecoveryServiceFabricPlatformUpdateDomainWalk. */ +public final class VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + "rgcompute", "aaaaaaaaaaaa", 9, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .forceRecoveryServiceFabricPlatformUpdateDomainWalkWithResponse( + "rgcompute", "aaaaaaaaaaaaaaaa", 30, null, null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4b338953c0ee2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetByResourceGroup. */ +public final class VirtualMachineScaleSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine scale set placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSet.json + */ + /** + * Sample code: Get a virtual machine scale set. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSet(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineScaleSetWithUserData.json + */ + /** + * Sample code: Get a virtual machine scale set with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineScaleSetWithUserData( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetInstanceViewSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetInstanceViewSamples.java new file mode 100644 index 0000000000000..fc400951e4194 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetInstanceViewSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetInstanceView. */ +public final class VirtualMachineScaleSetsGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetInstanceView_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetInstanceViewMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getInstanceViewWithResponse("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetInstanceView_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetInstanceViewMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getInstanceViewWithResponse("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetOSUpgradeHistorySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetOSUpgradeHistorySamples.java new file mode 100644 index 0000000000000..5cb07d6fda041 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsGetOSUpgradeHistorySamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetOSUpgradeHistory. */ +public final class VirtualMachineScaleSetsGetOSUpgradeHistorySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetOSUpgradeHistory_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetOSUpgradeHistoryMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getOSUpgradeHistory("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_GetOSUpgradeHistory_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsGetOSUpgradeHistoryMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().getOSUpgradeHistory("rgcompute", "aaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByLocationSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByLocationSamples.java new file mode 100644 index 0000000000000..0647ed9c820e3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListByLocation. */ +public final class VirtualMachineScaleSetsListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachineScaleSetsInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the VM scale sets under the specified subscription for the specified location. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllTheVMScaleSetsUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByLocation("eastus", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..e312c116aaf82 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListByResourceGroup. */ +public final class VirtualMachineScaleSetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByResourceGroup("rgcompute", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listByResourceGroup("rgcompute", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSamples.java new file mode 100644 index 0000000000000..0c484981de736 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets List. */ +public final class VirtualMachineScaleSetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().list(Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().list(Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSkusSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSkusSamples.java new file mode 100644 index 0000000000000..bd3bdf712a544 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsListSkusSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListSkus. */ +public final class VirtualMachineScaleSetsListSkusSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListSkus_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListSkus_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListSkusMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listSkus("rgcompute", "aaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ListSkus_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ListSkus_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsListSkusMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().listSkus("rgcompute", "aaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPerformMaintenanceSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPerformMaintenanceSamples.java new file mode 100644 index 0000000000000..7a5246ee9e6ed --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPerformMaintenanceSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets PerformMaintenance. */ +public final class VirtualMachineScaleSetsPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .performMaintenance( + "rgcompute", + "aaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().performMaintenance("rgcompute", "aa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPowerOffSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPowerOffSamples.java new file mode 100644 index 0000000000000..3c78b39af794b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsPowerOffSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets PowerOff. */ +public final class VirtualMachineScaleSetsPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().powerOff("rgcompute", "a", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .powerOff( + "rgcompute", + "aaaaaaaaaaaaaaaaaa", + true, + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRedeploySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRedeploySamples.java new file mode 100644 index 0000000000000..8a22d928faeb5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRedeploySamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Redeploy. */ +public final class VirtualMachineScaleSetsRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().redeploy("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .redeploy( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageAllSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageAllSamples.java new file mode 100644 index 0000000000000..76c39e8749d60 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageAllSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets ReimageAll. */ +public final class VirtualMachineScaleSetsReimageAllSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ReimageAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .reimageAll( + "rgcompute", + "aaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_ReimageAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().reimageAll("rgcompute", "aaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageSamples.java new file mode 100644 index 0000000000000..a70b361fcd4d2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsReimageSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetReimageParameters; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Reimage. */ +public final class VirtualMachineScaleSetsReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Reimage_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Reimage_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().reimage("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Reimage_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Reimage_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsReimageMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .reimage( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetReimageParameters() + .withTempDisk(true) + .withInstanceIds(Arrays.asList("aaaaaaaaaa")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRestartSamples.java new file mode 100644 index 0000000000000..880f3e23e92a4 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsRestartSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Restart. */ +public final class VirtualMachineScaleSetsRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .restart( + "rgcompute", + "aaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().restart("rgcompute", "aaaa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsSetOrchestrationServiceStateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsSetOrchestrationServiceStateSamples.java new file mode 100644 index 0000000000000..b300568d81039 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsSetOrchestrationServiceStateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceNames; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateAction; +import com.azure.resourcemanager.compute.generated.models.OrchestrationServiceStateInput; + +/** Samples for VirtualMachineScaleSets SetOrchestrationServiceState. */ +public final class VirtualMachineScaleSetsSetOrchestrationServiceStateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_SetOrchestrationServiceState_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsSetOrchestrationServiceStateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .setOrchestrationServiceState( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new OrchestrationServiceStateInput() + .withServiceName(OrchestrationServiceNames.AUTOMATIC_REPAIRS) + .withAction(OrchestrationServiceStateAction.RESUME), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_SetOrchestrationServiceState_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsSetOrchestrationServiceStateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .setOrchestrationServiceState( + "rgcompute", + "aaaaaaaaaaaaaaaa", + new OrchestrationServiceStateInput() + .withServiceName(OrchestrationServiceNames.AUTOMATIC_REPAIRS) + .withAction(OrchestrationServiceStateAction.RESUME), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsStartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsStartSamples.java new file mode 100644 index 0000000000000..611bca1191047 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsStartSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets Start. */ +public final class VirtualMachineScaleSetsStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .start( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceIDs().withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineScaleSets().start("rgcompute", "aaaaaaaaaaaaaaaaaaa", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateInstancesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateInstancesSamples.java new file mode 100644 index 0000000000000..da1b80bd60a0c --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateInstancesSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets UpdateInstances. */ +public final class VirtualMachineScaleSetsUpdateInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_UpdateInstances_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateInstancesMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .updateInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_UpdateInstances_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateInstancesMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachineScaleSets() + .updateInstances( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new VirtualMachineScaleSetVMInstanceRequiredIDs() + .withInstanceIds(Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaa")), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateSamples.java new file mode 100644 index 0000000000000..caa6287eeab87 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineScaleSetsUpdateSamples.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.generated.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.AdditionalUnattendContent; +import com.azure.resourcemanager.compute.generated.models.ApiEntityReference; +import com.azure.resourcemanager.compute.generated.models.AutomaticOSUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.generated.models.BillingProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.ComponentNames; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.IpVersion; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.PassNames; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.ProtocolTypes; +import com.azure.resourcemanager.compute.generated.models.ResourceIdentityType; +import com.azure.resourcemanager.compute.generated.models.RollingUpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SettingNames; +import com.azure.resourcemanager.compute.generated.models.Sku; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.UpgradeMode; +import com.azure.resourcemanager.compute.generated.models.UpgradePolicy; +import com.azure.resourcemanager.compute.generated.models.VaultCertificate; +import com.azure.resourcemanager.compute.generated.models.VaultSecretGroup; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSet; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentity; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetScaleInRules; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateNetworkConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateNetworkProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateOSDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateOSProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdatePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateStorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineScaleSetUpdateVMProfile; +import com.azure.resourcemanager.compute.generated.models.WinRMConfiguration; +import com.azure.resourcemanager.compute.generated.models.WinRMListener; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineScaleSets Update. */ +public final class VirtualMachineScaleSetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Update_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Update_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachineScaleSet resource = + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineScaleSets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineScaleSets_Update_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineScaleSetsUpdateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) throws IOException { + VirtualMachineScaleSet resource = + manager + .virtualMachineScaleSets() + .getByResourceGroupWithResponse("rgcompute", "aaaaaaaaaaaaa", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key246", "aaaaaaaaaaaaaaaaaaaaaaaa")) + .withSku(new Sku().withName("DSv3-Type1").withTier("aaa").withCapacity(7L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm") + .withPromotionCode("aaaaaaaaaa")) + .withIdentity( + new VirtualMachineScaleSetIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("key3951", new VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue()))) + .withUpgradePolicy( + new UpgradePolicy() + .withMode(UpgradeMode.MANUAL) + .withRollingUpgradePolicy( + new RollingUpgradePolicy() + .withMaxBatchInstancePercent(49) + .withMaxUnhealthyInstancePercent(81) + .withMaxUnhealthyUpgradedInstancePercent(98) + .withPauseTimeBetweenBatches("aaaaaaaaaaaaaaa") + .withEnableCrossZoneUpgrade(true) + .withPrioritizeUnhealthyInstances(true)) + .withAutomaticOSUpgradePolicy( + new AutomaticOSUpgradePolicy() + .withEnableAutomaticOSUpgrade(true) + .withDisableAutomaticRollback(true))) + .withAutomaticRepairsPolicy(new AutomaticRepairsPolicy().withEnabled(true).withGracePeriod("PT30M")) + .withVirtualMachineProfile( + new VirtualMachineScaleSetUpdateVMProfile() + .withOsProfile( + new VirtualMachineScaleSetUpdateOSProfile() + .withCustomData("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("aaaaaaaaaaaaaaaa") + .withAdditionalUnattendContent( + Arrays + .asList( + new AdditionalUnattendContent() + .withPassName(PassNames.OOBE_SYSTEM) + .withComponentName(ComponentNames.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("aaaaaaaaaaaaaaaaaaaa"))) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_OS) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)) + .withWinRM( + new WinRMConfiguration() + .withListeners( + Arrays + .asList( + new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("aaaaaaaaaaaaaaaaaaaaaa"))))) + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))) + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT))) + .withSecrets( + Arrays + .asList( + new VaultSecretGroup() + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}")) + .withVaultCertificates( + Arrays + .asList( + new VaultCertificate() + .withCertificateUrl("aaaaaaa") + .withCertificateStore("aaaaaaaaaaaaaaaaaaaaaaaaa")))))) + .withStorageProfile( + new VirtualMachineScaleSetUpdateStorageProfile() + .withImageReference( + new ImageReference() + .withId("aaaaaaaaaaaaaaaaaaa") + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest") + .withSharedGalleryImageId("aaaaaa")) + .withOsDisk( + new VirtualMachineScaleSetUpdateOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withWriteAcceleratorEnabled(true) + .withDiskSizeGB(6) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withVhdContainers(Arrays.asList("aa")) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa")))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaa") + .withLun(26) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId("aaaaaaaaaaaa"))) + .withDiskIopsReadWrite(28L) + .withDiskMBpsReadWrite(15L)))) + .withNetworkProfile( + new VirtualMachineScaleSetUpdateNetworkProfile() + .withHealthProbe( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123")) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetUpdateNetworkConfiguration() + .withId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withName("aaaaaaaa") + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withDnsSettings( + new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList())) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetUpdateIpConfiguration() + .withId("aaaaaaaaaaaaaaaa") + .withName("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetUpdatePublicIpAddressConfiguration() + .withName("a") + .withIdleTimeoutInMinutes(3) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("aaaaaaaaaaaaaaaaaa")) + .withDeleteOption(DeleteOptions.DELETE)) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withApplicationSecurityGroups( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withForceUpdateTag("aaaaaaaaa") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProtectedSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withProvisionAfterExtensions(Arrays.asList("aa")) + .withSuppressFailures(true))) + .withExtensionsTimeBudget("PT1H20M")) + .withLicenseType("aaaaaaaaaaaa") + .withBillingProfile(new BillingProfile().withMaxPrice(-1.0)) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT10M").withEnable(true))) + .withUserData("aaaaaaaaaaaaa")) + .withOverprovision(true) + .withDoNotRunExtensionsOnOverprovisionedVMs(true) + .withSinglePlacementGroup(true) + .withAdditionalCapabilities( + new AdditionalCapabilities().withUltraSsdEnabled(true).withHibernationEnabled(true)) + .withScaleInPolicy( + new ScaleInPolicy() + .withRules(Arrays.asList(VirtualMachineScaleSetScaleInRules.OLDEST_VM)) + .withForceDeletion(true)) + .withProximityPlacementGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .apply(); + } + + @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/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineSizesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineSizesListSamples.java new file mode 100644 index 0000000000000..744a42ee31269 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachineSizesListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineSizes List. */ +public final class VirtualMachineSizesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineSizes_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachineSizes_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineSizesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineSizes().list("._..", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineSizes_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachineSizes_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineSizesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachineSizes().list("-e", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesAssessPatchesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesAssessPatchesSamples.java new file mode 100644 index 0000000000000..32244f8ea1ae5 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesAssessPatchesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines AssessPatches. */ +public final class VirtualMachinesAssessPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineAssessPatches.json + */ + /** + * Sample code: Assess patch state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void assessPatchStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().assessPatches("myResourceGroupName", "myVMName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCaptureSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCaptureSamples.java new file mode 100644 index 0000000000000..09ea60bb02816 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCaptureSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineCaptureParameters; + +/** Samples for VirtualMachines Capture. */ +public final class VirtualMachinesCaptureSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Capture_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Capture_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesCaptureMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .capture( + "rgcompute", + "aaaaaaaaaaaaaaaaaaaa", + new VirtualMachineCaptureParameters() + .withVhdPrefix("aaaaaaaaa") + .withDestinationContainerName("aaaaaaa") + .withOverwriteVhds(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Capture_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Capture_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesCaptureMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .capture( + "rgcompute", + "aaaaaaaaaaaaa", + new VirtualMachineCaptureParameters() + .withVhdPrefix("aaaaaaaaa") + .withDestinationContainerName("aaaaaaa") + .withOverwriteVhds(true), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesConvertToManagedDisksSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesConvertToManagedDisksSamples.java new file mode 100644 index 0000000000000..219865c250524 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesConvertToManagedDisksSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ConvertToManagedDisks. */ +public final class VirtualMachinesConvertToManagedDisksSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ConvertToManagedDisks_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesConvertToManagedDisksMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().convertToManagedDisks("rgcompute", "aaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ConvertToManagedDisks_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesConvertToManagedDisksMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().convertToManagedDisks("rgcompute", "aaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCreateOrUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a739821d62788 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesCreateOrUpdateSamples.java @@ -0,0 +1,2257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.compute.generated.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.generated.models.ApplicationProfile; +import com.azure.resourcemanager.compute.generated.models.BootDiagnostics; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DeleteOptions; +import com.azure.resourcemanager.compute.generated.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.generated.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.generated.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.generated.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.generated.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.generated.models.PatchSettings; +import com.azure.resourcemanager.compute.generated.models.Plan; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSku; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.compute.generated.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.compute.generated.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.generated.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.compute.generated.models.SecurityProfile; +import com.azure.resourcemanager.compute.generated.models.SecurityTypes; +import com.azure.resourcemanager.compute.generated.models.SshConfiguration; +import com.azure.resourcemanager.compute.generated.models.SshPublicKey; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.generated.models.UefiSettings; +import com.azure.resourcemanager.compute.generated.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.compute.generated.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.generated.models.VMSizeProperties; +import com.azure.resourcemanager.compute.generated.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachinePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import com.azure.resourcemanager.compute.generated.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.generated.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.generated.models.WindowsVMGuestPatchMode; +import java.util.Arrays; + +/** Samples for VirtualMachines CreateOrUpdate. */ +public final class VirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromASharedGalleryImage.json + */ + /** + * Sample code: Create a VM from a shared gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMFromASharedGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withSharedGalleryImageId( + "/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithVMSizeProperties.json + */ + /** + * Sample code: Create a VM with VM Size Properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile() + .withVmSize(VirtualMachineSizeTypes.STANDARD_D4_V3) + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(1).withVCpusPerCore(1))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("U29tZSBDdXN0b20gRGF0YQ==") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ + /** + * Sample code: Create a platform-image vm with unmanaged os and data disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAPlatformImageVmWithUnmanagedOsAndDataDisks( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE)) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Linux vm with a patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(LinuxPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Cache disk using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a vm with a marketplace image plan. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithAMarketplaceImagePlan( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByOS.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByOS. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOS( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_OS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Windows vm with patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(WindowsPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Windows vm with a patch setting assessmentMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithPremiumStorage.json + */ + /** + * Sample code: Create a vm with premium storage. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithPremiumStorage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithCapacityReservation.json + */ + /** + * Sample code: Create or update a VM with capacity reservation. + * + * @param manager Entry point to ComputeManager. + */ + public static void createOrUpdateAVMWithCapacityReservation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting assessmentMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings().withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByPlatform and enableHotpatching set + * to true. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withEnableHotpatching(true)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a vm with an extensions time budget. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithAnExtensionsTimeBudget( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionsTimeBudget("PT30M") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image vm from an unmanaged generalized os image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createACustomImageVmFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withOsDisk( + new OSDisk() + .withOsType(OperatingSystemTypes.WINDOWS) + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithEncryptionAtHost.json + */ + /** + * Sample code: Create a vm with Host Encryption using encryptionAtHost property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmInAnAvailabilitySet.json + */ + /** + * Sample code: Create a vm in an availability set. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmInAnAvailabilitySet( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withAvailabilitySet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}")) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithEmptyDataDisks.json + */ + /** + * Sample code: Create a vm with empty data disks. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEmptyDataDisks(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSecurityTypeConfidentialVM.json + */ + /** + * Sample code: Create a VM with securityType ConfidentialVM with Platform Managed Keys. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithSecurityTypeConfidentialVMWithPlatformManagedKeys( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile().withVmSize(VirtualMachineSizeTypes.fromString("Standard_DC2as_v5"))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType( + SecurityEncryptionTypes.DISK_WITH_VMGUEST_STATE))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithNetworkInterfaceConfiguration.json + */ + /** + * Sample code: Create a VM with network interface configuration. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithNetworkInterfaceConfiguration( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceConfiguration() + .withName("{nic-config-name}") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceIpConfiguration() + .withName("{ip-config-name}") + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachinePublicIpAddressConfiguration() + .withName("{publicIP-config-name}") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.GLOBAL)) + .withDeleteOption(DeleteOptions.DETACH) + .withPublicIpAllocationMethod( + PublicIpAllocationMethod.STATIC))))))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromACustomImage.json + */ + /** + * Sample code: Create a vm from a custom image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromACustomImage(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithHibernationEnabled.json + */ + /** + * Sample code: Create a VM with HibernationEnabled. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithHibernationEnabled( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("eastus2euap") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2019-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withAdditionalCapabilities(new AdditionalCapabilities().withHibernationEnabled(true)) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithUefiSettings.json + */ + /** + * Sample code: Create a VM with Uefi Settings of secureBoot and vTPM. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithApplicationProfile.json + */ + /** + * Sample code: Create a vm with Application Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithApplicationProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1")))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a vm from a specialized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromASpecializedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithPasswordAuthentication.json + */ + /** + * Sample code: Create a vm with password authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithPasswordAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain.json + */ + /** + * Sample code: Create a vm in a Virtual Machine Scale Set with customer assigned platformFaultDomain. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withVirtualMachineScaleSet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}")) + .withPlatformFaultDomain(1) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithScheduledEventsProfile.json + */ + /** + * Sample code: Create a vm with Scheduled Events Profile. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithScheduledEventsProfile( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT10M").withEnable(true))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithBootDiagnostics.json + */ + /** + * Sample code: Create a vm with boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSshAuthentication.json + */ + /** + * Sample code: Create a vm with ssh authentication. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithSshAuthentication( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromACommunityGalleryImage.json + */ + /** + * Sample code: Create a VM from a community gallery image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMFromACommunityGalleryImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withCommunityGalleryImageId( + "/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Resource disk using placement property. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithADiffOsDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithEphemeralOsDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings(new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateOrUpdateAVmWithUserData.json + */ + /** + * Sample code: Create a VM with UserData. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithUserData(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("{vm-name}") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==") + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a vm from a generalized shared image. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmFromAGeneralizedSharedImage( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfManual.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of Manual. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfManual( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings(new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.MANUAL)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithSecurityTypeConfidentialVMWithCustomerManagedKeys.json + */ + /** + * Sample code: Create a VM with securityType ConfidentialVM with Customer Managed Keys. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVMWithSecurityTypeConfidentialVMWithCustomerManagedKeys( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile( + new HardwareProfile().withVmSize(VirtualMachineSizeTypes.fromString("Standard_DC2as_v5"))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("2019-datacenter-cvm") + .withSku("windows-cvm") + .withVersion("17763.2183.2109130127")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS) + .withSecurityProfile( + new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.DISK_WITH_VMGUEST_STATE) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM)) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateALinuxVmWithPatchSettingModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting patchMode of ImageDefault. + * + * @param manager Entry point to ComputeManager. + */ + public static void createALinuxVmWithAPatchSettingPatchModeOfImageDefault( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings().withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a vm with managed boot diagnostics. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithManagedBootDiagnostics( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true))) + .create(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/CreateAVmWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a vm with DiskEncryptionSet resource id in the os disk and data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .define("myVM") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"))), + new DataDisk() + .withLun(1) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.ATTACH) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .create(); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeallocateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeallocateSamples.java new file mode 100644 index 0000000000000..b89ab347ede12 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeallocateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Deallocate. */ +public final class VirtualMachinesDeallocateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Deallocate_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Deallocate_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesDeallocateMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().deallocate("rgcompute", "aaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Deallocate_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Deallocate_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesDeallocateMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().deallocate("rgcompute", "aaaaaaaaaa", true, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeleteSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeleteSamples.java new file mode 100644 index 0000000000000..4d3c07bb158e6 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ForceDeleteVirtualMachine.json + */ + /** + * Sample code: Force delete a VM. + * + * @param manager Entry point to ComputeManager. + */ + public static void forceDeleteAVM(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().delete("myResourceGroup", "myVM", true, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGeneralizeSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGeneralizeSamples.java new file mode 100644 index 0000000000000..84d40e687aada --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGeneralizeSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Generalize. */ +public final class VirtualMachinesGeneralizeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GeneralizeVirtualMachine.json + */ + /** + * Sample code: Generalize a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void generalizeAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().generalizeWithResponse("myResourceGroup", "myVMName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGetByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..2ecb2f2f3a7ab --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesGetByResourceGroupSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineWithVMSizeProperties.json + */ + /** + * Sample code: Get a virtual machine with VM Size Properties. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachineWithVMSizeProperties( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachine.json + */ + /** + * Sample code: Get a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void getAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstallPatchesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstallPatchesSamples.java new file mode 100644 index 0000000000000..6ce87fce4254e --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstallPatchesSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchClassificationWindows; +import com.azure.resourcemanager.compute.generated.models.VMGuestPatchRebootSetting; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.generated.models.WindowsParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for VirtualMachines InstallPatches. */ +public final class VirtualMachinesInstallPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachineInstallPatches.json + */ + /** + * Sample code: Install patch state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void installPatchStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .installPatches( + "myResourceGroupName", + "myVMName", + new VirtualMachineInstallPatchesParameters() + .withMaximumDuration("PT4H") + .withRebootSetting(VMGuestPatchRebootSetting.IF_REQUIRED) + .withWindowsParameters( + new WindowsParameters() + .withClassificationsToInclude( + Arrays + .asList( + VMGuestPatchClassificationWindows.CRITICAL, + VMGuestPatchClassificationWindows.SECURITY)) + .withMaxPatchPublishDate(OffsetDateTime.parse("2020-11-19T02:36:43.0539904+00:00"))), + Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstanceViewSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstanceViewSamples.java new file mode 100644 index 0000000000000..e4c71be3a143f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesInstanceViewSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines InstanceView. */ +public final class VirtualMachinesInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineInstanceView.json + */ + /** + * Sample code: Get Virtual Machine Instance View. + * + * @param manager Entry point to ComputeManager. + */ + public static void getVirtualMachineInstanceView( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine placed on a dedicated host group through automatic placement. + * + * @param manager Entry point to ComputeManager. + */ + public static void getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListAvailableSizesSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListAvailableSizesSamples.java new file mode 100644 index 0000000000000..9432b8b49c007 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListAvailableSizesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListAvailableSizes. */ +public final class VirtualMachinesListAvailableSizesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListAvailableVmSizes_VirtualMachines.json + */ + /** + * Sample code: Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listAvailableSizes("myResourceGroup", "myVmName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByLocationSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByLocationSamples.java new file mode 100644 index 0000000000000..234de671bc392 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByLocation. */ +public final class VirtualMachinesListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ListVirtualMachinesInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the virtual machines under the specified subscription for the specified location. + * + * @param manager Entry point to ComputeManager. + */ + public static void listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByLocation("eastus", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByResourceGroupSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..26a24a59c8633 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListByResourceGroupSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByResourceGroup. */ +public final class VirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_List_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_List_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByResourceGroup("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_List_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_List_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().listByResourceGroup("rgcompute", null, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListSamples.java new file mode 100644 index 0000000000000..9a949140a3351 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesListSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines List. */ +public final class VirtualMachinesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ListAll_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ListAll_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListAllMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_ListAll_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_ListAll_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesListAllMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().list("aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPerformMaintenanceSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPerformMaintenanceSamples.java new file mode 100644 index 0000000000000..721b70a71767f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPerformMaintenanceSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines PerformMaintenance. */ +public final class VirtualMachinesPerformMaintenanceSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PerformMaintenance_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PerformMaintenance_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPerformMaintenanceMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().performMaintenance("rgcompute", "aaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PerformMaintenance_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PerformMaintenance_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPerformMaintenanceMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().performMaintenance("rgcompute", "aaaaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPowerOffSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPowerOffSamples.java new file mode 100644 index 0000000000000..fe2da7f56940f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesPowerOffSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines PowerOff. */ +public final class VirtualMachinesPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PowerOff_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PowerOff_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPowerOffMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().powerOff("rgcompute", "aaaaaaaaaaaaaaaaaa", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_PowerOff_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_PowerOff_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesPowerOffMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().powerOff("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", true, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReapplySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReapplySamples.java new file mode 100644 index 0000000000000..467b1816d5963 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReapplySamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Reapply. */ +public final class VirtualMachinesReapplySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ReapplyVirtualMachine.json + */ + /** + * Sample code: Reapply the state of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void reapplyTheStateOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().reapply("ResourceGroup", "VMName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRedeploySamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRedeploySamples.java new file mode 100644 index 0000000000000..409b6b2e8a1f2 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRedeploySamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Redeploy. */ +public final class VirtualMachinesRedeploySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Redeploy_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Redeploy_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRedeployMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().redeploy("rgcompute", "aaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Redeploy_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Redeploy_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRedeployMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().redeploy("rgcompute", "a", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReimageSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReimageSamples.java new file mode 100644 index 0000000000000..217c3b249c771 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesReimageSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineReimageParameters; + +/** Samples for VirtualMachines Reimage. */ +public final class VirtualMachinesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/ReimageVirtualMachine.json + */ + /** + * Sample code: Reimage a Virtual Machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void reimageAVirtualMachine(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .reimage( + "myResourceGroup", "myVMName", new VirtualMachineReimageParameters().withTempDisk(true), Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRestartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRestartSamples.java new file mode 100644 index 0000000000000..50d538643322b --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRestartSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Restart. */ +public final class VirtualMachinesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Restart_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Restart_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRestartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().restart("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Restart_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Restart_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesRestartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().restart("rgcompute", "aaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java new file mode 100644 index 0000000000000..b8457ad6d2b6f --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines RetrieveBootDiagnosticsData. */ +public final class VirtualMachinesRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/RetrieveBootDiagnosticsDataVirtualMachine.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "VMName", 60, Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRunCommandSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRunCommandSamples.java new file mode 100644 index 0000000000000..98363c83ff4cd --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesRunCommandSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.RunCommandInput; + +/** Samples for VirtualMachines RunCommand. */ +public final class VirtualMachinesRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/runCommands/VirtualMachineRunCommand.json + */ + /** + * Sample code: VirtualMachineRunCommand. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachineRunCommand(com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager + .virtualMachines() + .runCommand( + "crptestar98131", "vm3036", new RunCommandInput().withCommandId("RunPowerShellScript"), Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesSimulateEvictionSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesSimulateEvictionSamples.java new file mode 100644 index 0000000000000..6bad32f22fac9 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesSimulateEvictionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines SimulateEviction. */ +public final class VirtualMachinesSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/SimulateEvictionOfVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param manager Entry point to ComputeManager. + */ + public static void simulateEvictionAVirtualMachine( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().simulateEvictionWithResponse("ResourceGroup", "VMName", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesStartSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesStartSamples.java new file mode 100644 index 0000000000000..c8bc0fbc8b6ac --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesStartSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Start_MaximumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Start_MaximumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesStartMaximumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().start("rgcompute", "aaaaaaaaaaaaaaaaaaaa", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/VirtualMachines_Start_MinimumSet_Gen.json + */ + /** + * Sample code: VirtualMachines_Start_MinimumSet_Gen. + * + * @param manager Entry point to ComputeManager. + */ + public static void virtualMachinesStartMinimumSetGen( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + manager.virtualMachines().start("rgcompute", "aaaaa", Context.NONE); + } +} diff --git a/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesUpdateSamples.java b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesUpdateSamples.java new file mode 100644 index 0000000000000..28ca1226fb6e3 --- /dev/null +++ b/sdk/compute/azure-resourcemanager-compute-generated/src/samples/java/com/azure/resourcemanager/compute/generated/generated/VirtualMachinesUpdateSamples.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.generated.models.CachingTypes; +import com.azure.resourcemanager.compute.generated.models.DataDisk; +import com.azure.resourcemanager.compute.generated.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.generated.models.DiskDetachOptionTypes; +import com.azure.resourcemanager.compute.generated.models.HardwareProfile; +import com.azure.resourcemanager.compute.generated.models.ImageReference; +import com.azure.resourcemanager.compute.generated.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.generated.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.generated.models.NetworkProfile; +import com.azure.resourcemanager.compute.generated.models.OSDisk; +import com.azure.resourcemanager.compute.generated.models.OSProfile; +import com.azure.resourcemanager.compute.generated.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.generated.models.StorageProfile; +import com.azure.resourcemanager.compute.generated.models.VirtualMachine; +import com.azure.resourcemanager.compute.generated.models.VirtualMachineSizeTypes; +import java.util.Arrays; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ + /** + * Sample code: Update a VM by detaching data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAVMByDetachingDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachine resource = + manager + .virtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE) + .getValue(); + resource + .update() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .apply(); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/UpdateVMForceDetachDataDisk.json + */ + /** + * Sample code: Update a VM by force-detaching data disk. + * + * @param manager Entry point to ComputeManager. + */ + public static void updateAVMByForceDetachingDataDisk( + com.azure.resourcemanager.compute.generated.ComputeManager manager) { + VirtualMachine resource = + manager + .virtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE) + .getValue(); + resource + .update() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters().withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true) + .withDetachOption(DiskDetachOptionTypes.FORCE_DETACH), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .apply(); + } +} diff --git a/sdk/compute/ci.yml b/sdk/compute/ci.yml new file mode 100644 index 0000000000000..458f922e955b6 --- /dev/null +++ b/sdk/compute/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.yml + - sdk/compute/azure-resourcemanager-compute-generated/ + exclude: + - sdk/compute/pom.xml + - sdk/compute/azure-resourcemanager-compute-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.yml + - sdk/compute/azure-resourcemanager-compute-generated/ + exclude: + - sdk/compute/pom.xml + - sdk/compute/azure-resourcemanager-compute-generated/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: compute + Artifacts: + - name: azure-resourcemanager-compute-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercomputegenerated diff --git a/sdk/compute/pom.xml b/sdk/compute/pom.xml new file mode 100644 index 0000000000000..8af75841014a6 --- /dev/null +++ b/sdk/compute/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-compute-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-compute-generated + + + +